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 amongst 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 is called a hop.
The IP address fields in the IP header play a very important role in sending a 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.
This specifies the size of the header itself. The minimum 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.
The Differentiated Services field is used for marking packets. Different Quality-Of-Service (QoS) levels can be applied on different markings. For example, data belonging to voice and video protocols have no tolerance for delay. The DS field is used to mark packets carrying data belonging to these protocols so that they get priority treatment through the network. On the other hand, peer-to-peer traffic is considered a major problem and can be marked down to give in best effort treatment.
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 identify the fragments that make up the original segment. Each fragment of a segment will have the same identification number.
Used for fragmentation process.
This field identifies the fragment number and is used 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 contains a TCP segment while a value of 17 signifies a UDP segment. Apart from TCP and UDP, there are many protocols whose data can be carried in an IP packet.
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.