IP Header (Compatibility Mode)
IP Header (Compatibility Mode)
The basic IPv4 packet header has 12 fields with a total size of 20 octets (160 bits).
The 12 fields may be followed by an Options field, which is followed by a data portion that is usually the transport-layer packet. The variable length of the Options field adds to the total size of the IPv4 packet header.
10
11
IP Datagram Format
bit # 0 version header length Identification time-to-live (TTL) protocol source IP address destination IP address options (0 to 40 bytes) payload 7 8 DS 15 16 ECN 0 D M F F 23 24 31 total length (in bytes) Fragment offset header checksum
4 bytes
20 bytes Header Size < 24 x 4 bytes = 60 bytes 20 bytes Total Length < 216 bytes = 65536 bytes
14
15
Header checksum (2 bytes): A simple 16-bit long checksum which is computed for the header of the datagram.
16
Padding: Padding bytes are added to ensure that header ends on a 4-byte boundary
17
Fields were removed from the IPv6 header because, in IPv6, fragmentation is not handled by routers and checksums at the network layer are not used. Instead, fragmentation in IPv6 is handled by the source of a packet and checksums at the data link layer and transport layer are used. In IPv6, use of the UDP checksum is required to check the integrity of the inner packet. Additionally, the basic IPv6 packet header and Options field are aligned to 64 bits, which can facilitate the processing of IPv6 packets.
19
18
Version: Same as in IPv4 Traffic Class: Similar to the Type of Service field in the IPv4 packet header. The Traffic Class field tags packets with a traffic class that is used in differentiated services. Flow Label: A new field in the IPv6 packet header. The Flow Label field tags packets with a specific flow that differentiates the packets at the network layer. Payload Length: Similar to the Total Length field in the IPv4 packet header.
20
Next Header: Similar to the Protocol field in the IPv4 packet header. Hop Limit: Similar to the Time to Live field in the IPv4 packet header. Because no checksum is in the IPv6 header, the router can decrement the value without needing to recalculate the checksum, which saves processing resources.
21