Page182
Key IPv4 Header Fields
An IP header, shown in Fig. 5.1, is 20 bytes long (with no options), and contains a number of fields. Key fields are:
- Version: IP version (4 for IPv4)
- IHL: Length of the IP header
- Type of Service: originally used to set the precedence of the packet, but now used for Differentiated Services (DiffServ), a method for providing Quality of Service (QoS)
- Identification, Flags, Offset: used for IP fragmentation
- Time To Live: to end routing loops
- Protocol: embedded protocol (protocol number representing TCP, UDP, etc.)
- Source and Destination IP addresses
- Optional: Options and padding
Fig. 5.1 IPv4 header [3].
IP Fragmentation
If a packet exceeds the Maximum Transmission Unit (MTU) of a network, a router along the path may fragment it. An MTU is the maximum PDU size on a network. Fragmentation breaks a large packet into multiple smaller packets. A typical MTU size for an IP packet is 1500 bytes. The IP Identification field (IPID) is used to re-associate fragmented packets (they will have the same IPID). The flags are used to determine if fragmentation is allowed, and whether more fragments are coming. The fragment offset gives the data offset the current fragment carries: “Copy this data beginning at offset 1480.”
Path MTU discovery uses fragmentation to discover the largest size packet allowed across a network path. A large packet is sent with the DF (do not fragment) flag set. A router with a smaller MTU than the packet size will seek to fragment, see that it cannot, and then drop it, sending a “Fragmentation needed and DF set” ICMP message. The sending node then sends increasingly smaller packets with the DF flag set, until they pass cleanly across the network path.