The Internet Protocol: IPV4 Packets
Now that we have clarified the allocation of IPv4 addresses and the utilization of the longest prefix match to forward IPv4 packets, we can have a more detailed look at IPv4 by starting with the format of the IPv4 packets.
The IPv4 packet format was defined in RFC 791. Apart from a few clarifications and some backward compatibility changes, the IPv4 packet format did not change significantly since the publication of RFC 791. All IPv4 packets use a 20-byte header as shown below. Some IPv4 packets contain an optional header extension that is described later.
IPv4 Packet Header
Fields of The Header
The main fields of the IPv4 header are:
- A 4 bit version that indicates the version of IP used to build the header. Using a version field in the header allows the network layer protocol to evolve.
- A 4 bit IP Header Length (IHL) that indicates the length of the IP header in 32-bit words. This field allows IPv4 to use options if required, but as it is encoded as a 4 bits field, the IPv4 header cannot be longer than 64 bytes.
- An 8 bit DS field that is used for Quality of Service.
- A 16 bit length field that indicates the total length of the entire IPv4 packet (header and