Internet Protocol (IP)

Each host in a network and all interfaces of a router have a logical address called the IP address. All hosts in a network are grouped in a single IP address range which is called its net or subnet and each host having a unique address from that range. Each network has a different address range and routers that operate on layer 3 connect these different networks.

As IP receives segments from TCP or UDP, it adds a header with source IP address and destination IP address among other information. This PDU is called a packet. When a router receives a packet, it looks at the destination address in the header and forwards it towards the destination network. The packet may need to go through multiple routers before it reaches the destination network. Each router it has to go through called a hop.

The IP address fields in the IP header play a very important role in sending data through different hops. In fact, IP addresses are so important in a network that the next Chapter is entirely dedicated to IP Address. Following is IPv4 header and its important fields:-


                Figure 1-12 IPv4 Header


There are two versions of the Internet Protocol(Version 6 and Version 4). Version 4 is the most used version in today networking. Figure 1-12 shows the header structure of IPv4. The following fields make up the header:-


IP version number. For IPv4 this value is 4.

Header Length

This specifies the size of the header itself. The smallest size is 20 bytes. The figure does not show the rarely used options field that is of a variable length. Most IPv4 headers are 20 bytes in length.

DS Field

The Differentiated Services field marking packets. Different Quality-Of-Service (QoS) levels can be applied to different markings. For example, data belonging to voice and video protocols have no tolerance for delay. The DS field also marks packets carrying data belonging to these protocols so that they get priority treatment through the network. On the other hand, peer-to-peer traffic considered a major problem and can mark down to give in best effort treatment.

Total Length

This field specifies the size of the packet. This means the size of the header plus the size of the data.


When IP receives a segment from TCP or UDP; it may need to break the segment into chunks called fragments before sending it out to the network. Identification fields serve to find the fragments that make up the original segment. Each fragment of a segment will have the same identification number.


Used for fragmentation process.

Fragment Offset

This field identifies the fragment number by hosts to reassemble the fragments in the correct order.

Time to Live

The Time to Live (TTL) value is set to the originating host. Each router that the packet passes through reduces the TTL by one. If the TTL reaches 0 before reaching the destination, the packet is dropped. This is done to prevent the packet from moving around the network endlessly.


This field identifies the protocol to which the data it is carrying belongs. For example, a value of 6 implies that the data has a TCP segment while a value of 17 signifies a UDP segment. Apart from TCP and UDP, there are many protocols whose data can carry in an IP packet.

Header Checksum

This field is used to check for errors in the header. At each router and at the destination, a cyclic redundancy check performed on the header and the result should match the value stored in this field. If the value does not match, the packet is discarded.

Source IP address – This field stores the IP address of the source of the packet.

Destination IP address – This field stores the IP address of the destination of the packet.