An Overview of the IPV4 Header

The Internet Protocol (IP) is the heart of the internet and is primarily responsible for carrying end to end data from the source computer to the destination computer through a wide range of intermediate networks and physical media. As described in the previous posts, IP is a datagram oriented best-effort connection-less protocol.
This post gives a brief overview of the IPV4 (version 4) header.

A typical IPV4 header

A typical IPV4 header

As shown in the above diagram, the IPV4 header consists of the following fields:
Version – Denotes the version of the IP protocol and can be either 4 or 6 (in hex).
IHL – IP header length (would normally have a value of 0x05). We multiply by 4 to get the standard IP Header length of 20 bytes(without options). If the IP header has options, then the value would be higher.
TOS (Type of Service) – Used for QOS purposes to give the necessary preferential treatment to the packet by the network.
Total Length – Denotes the total IP datagram length including the header and data.
Identification, MF, DF, Fragment Offset – These 4 fields are used together for fragmentation purposes, when the IP datagram has to be fragmented on its way from the source to the destination end point. In IPV4, Fragmentation is typically done in intermediate routers if an IP datagram is bigger than the outgoing interfaces MTU (Maximum Transmission Unit). In IPV6, there is no concept of fragmentation inside intermediate routers and has to be taken care at the source computer, by calculating the path MTU.
TTL (Time To Live) – Used to limit the life of an IP packet inside the network, to take care of loops in the network. Each router in the path of an IP packet decrements the value of TTL by 1 and if a router encounters an IP packet with a TTL value of 0 (after decrementing), then the IP Packet is dropped at the router.
Protocol – Has the value of the transport/higher layer protocol carried by the IP datagram (e.g. TCP, UDP, RIP, BGP, OSPF, ICMP etc.)
Header Checksum – Contains a checksum of the IP header alone, to make sure that the IP header has not changed during transportation over the network.
Source and Destination IP addresses – Has the 4 byte source and destination IPV4 addresses.
IP options – Can have fields used for special purposes like loose source routing, strict source routing, record route, timestamping etc. But IP options are rarely used these days.

Leave a Reply

Your email address will not be published. Required fields are marked *