IPv4 Header¶
In the IPv4 header:¶
Version: Indicates the IP protocol's version. - For IPv4, this is always equal to 4
IHL (Internet Header Length): Specifies the length of the IP header in 32-bit words. - The IHL field contains the size of the IPv4 header; it has 4 bits that specify the number of 32-bit words in the header. The minimum value for this field is 5
Differentiated Services Code Point (DSCP): This is Used for quality of service (QoS) mechanisms. - Real-time data streaming makes use of the DSCP field. An example is Voice over IP (VoIP)
Total Length: Specifies the IP packet's total length, including header and data. - This 16-bit field defines the packet size in bytes, including header and data. The minimum size is 20 bytes (header without data), and the maximum is 65,535.
Identification: Used for uniquely identifying fragments of an IP datagram. - This field is an identification field primarily used to uniquely identify the group of fragments of a single IP datagram.
Flags: Control fragmentation behavior. - A three-bit field follows and is used to control or identify fragments. They are (in order, from most significant to least significant: - bit 0: Reserved; must be zero. - bit 1: Don't Fragment (DF) - bit 2: More Fragments (MF) - If the DF flag is set, and fragmentation is required to route the packet, then the packet is dropped. This can be used when sending packets to a host that does not have resources to perform fragment reassembly. All fragments except the last have the MF flag set for fragmented packets. The last fragment has a non-zero Fragment Offset field, differentiating it from an unfragmented packet.
Fragment Offset: Indicates the fragment's position in the original datagram. - This field specifies the offset of a particular fragment relative to the beginning of the original unfragmented IP datagram. The fragmentation offset value for the first fragment is always 0. The field is 13 bits wide so that the offset can be from 0 to 8191
Time to Live (TTL): Limits the lifespan of a packet in the network. - An eight-bit time-to-live field limits a datagram's lifetime to prevent network failure in the event of a routing loop. In practice, the field is used as a hop count
Protocol: Specifies the protocol encapsulated in the payload of the IP packet. - This field defines the protocol used in the data portion of the IP datagram.
Header Checksum: Provides error-checking for the IP header. - The 16-bit IPv4 header checksum field is used to check the header for errors. When a packet arrives at a router or its destination, the network device calculates the checksum of the header, including the checksum field. A value of 0xFFFF is expected. If a different result is obtained, the device discards the packet.
Source IP Address: Specifies the sender's IP address. - This 32-bit field is the IPv4 address of the packet's sender. It may be changed in transit by network address translation (NAT).
Destination IP Address: Specifies the recipient's IP address. - This 32-bit field is the IPv4 address of the packet receiver. It may be affected by NAT. Each field has a specific length and purpose within the IPv4 header.