Understanding the IP address and IPv4 Packet Header

This is in continuation of our last one article, a new series of networking articles. In this segment, we are going to discuss the idea of IP addresses and how the IPv4 packets are developed.

In the world of the internet, each location or device on a system must be addressable. This is essentially a term that implies that it very well may become by referencing its designation under an arrangement of addresses. Suppose, if one PC needs to speak with another PC, it can deliver the data to another PC’s IP address just like in the real world we send something to a particular home address. Every IP address of a device must be unique in its own network system. There are two distinct variants of IP addresses: IPv4 and IPv6.

Internet Protocol Version 4 (IPv4) defines an IP address as a 32-bit number which is equivalent to 2^32 IP addresses. But, because of the development of the Internet (the number of devices increased), another version of IP (IPv6), using 128 bits for the IP address i.e. 2^128. IPv6 deployment has been continuous since the mid-2000s.

The present version of IP that is being used for the most part is version 4, indicated as IPv4 (however IPv6 is likewise now being used in numerous places). The development of packets under IPv4 is made with headers as appeared in the diagram. Headers at each stage are comprised of 4 bytes or 32 bits.

, Understanding the IP address and IPv4 Packet Header, TechRX

Headers at the first stage are

1. 4-bit version field, which shows an IP version used in the IP datagram/packet. The most generally used version is IPv4. IPv6 (IP Version 6) has just risen as a superior other option.

2. 4-bit length field, which is called the Internet Header Length (IHL). It contains data about the number of 32-bit words in the header of the IP datagram.

3. 8-bit Type of Service (TOS) field, which demonstrates whether the IP datagram should get any special type of service or not. In light of the sign about special service offers, priority or precedence is given to the specific packet over different packets. This helps the routers to select the proper route for the transmission of the packets.

TOS field divides into two subfields: 5-bit D/T/R/C/R (low delay – high throughput – high reliability – low cost – reserved) and 3-bit precedence.

An IP datagram for a normal packet with no special priority need will have D/T/R/C/ sub-field set as 0000, precedence sub-field set as 000 and 1 bit reserved or unused in this case. Consider a multimedia packet that may require higher throughput and most significant level priority then IP datagram will set D/T/C/R sub-field as 0100 and priority sub-field as 111.

TOS field is used by routers to select the routing way. In the event that a standard datagram that needs a normal service reaches a router, the router chooses a normal route according to the routing strategy system. But, when a datagram requiring minimum cost, the selects a route with the minimum number of hops.

Similarly, for a datagram with higher reliability, the router chooses a more reliable (lower Bit Error Rate) path.

In like manner, for a datagram with higher throughput, a route with higher link capacity should be chosen. The standard is now set for different services of various TOS fields.

4. 16-Bit Total Length (TL) field, which shows the total number of bytes that the datagram conveys including headers. The maximum number of bytes that a datagram conveys is 65,535. IHL, field includes just the header fields in units of 32-bit or 4-byte words. But, TL includes the entire packets in bytes. The whole IP datagram is variable as are header fields. Utilizing IHL the receiver recognizes the number of header bytes in a packet.

At the second stage, there are three headers, as follows:

1. In the identification field, a 16-bit header connects the various sorts of systems intended to convey packets of various sizes. For instance, Ethernet packets might be in the scope of 64 to 1518 bytes. At the point when a packet of size 1500 bytes reaches a hub or switch, and the equivalent is required to be transferred or routed to a system, let’s say, having maximum packet size of 512 bytes, it is required that the arriving packet of 1500 bytes is divided into a few smaller packets (known as fragmentation), each having a size of 512 bytes or less.

Each fragmented packet of a particular original packet must be given some identification so that the receiver can recombine all related fragments in packets. The same identification to all fragments of a packet ensures that wrong fragments are not combined to reconstruct the original packet in the receiver.

2. 3-bit flags are used to control and convey information with regards to fragmentation. The left-most bit is reserved. The middle bit, known as Don’t Fragment (DF), provides flexibility to the sender. If the sender wishes that the packet must not be fragmented, even if it does not reach the destination, it can construct an IP datagram with the DF bit set to 1. When DF bit is set to zero, fragmentation is allowed. More Fragments (MF = 1 bit) – tells if more fragments are there ahead of this fragment for example if MF = 1, more fragments are ahead of this fragment and if MF = 0, it is the last fragment.

3. 13-bit fragment offset indicates how to insert fragments (in the sequence of frames) in the receiver’s buffer to reconstruct the original datagram.

Headers at the third stage are:

1. 8-bit lifetime or time-to-live (TTL) field that is used to guarantee that an IP packet doesn’t hang on on the Internet forever. If the packets hang on in the internet system always, congestion will undoubtedly happen. So TTL, in its own right, gives a mechanism to avoid congestion on the Internet. The maximum TTL field is 255. In the old days, it was taken as 255 seconds. By and by, the TTL field is taken as a hop counter. Along these lines, an IP packet can move the most extreme 255 hops on the Internet.

2. 8-bit protocol field that defines the protocol wherein the information is encapsulated. For instance, when the IP datagram conveys a protocol field with 6, it implies data is a TCP pack. For UDP it is 17.

3. Header checksum field that is of 16 bits. This field is used to check for errors on the header fields of the IP datagram. The checksum is calculated using 1’s complement addition rule.

The following two stages are for addresses:

IP header has two addresses as appeared in diagram; Source IP address (the device address from which the datagram is sent) and Destination IP address (the device address to which the datagram is sent, from the source IP address). These are used to route datagrams.

At the last stage:

The two headers are Options and Padding.

Options field in the IP header is optional, it can vary in length and is used in testing, debugging and security. This field is made of Option-Type field, Option-Length field and then Option-Data bytes.

Padding is basically used to ensure that the IP packet header has a length that is a multiple of 32 bits. It is required because of the varying length of the Option-field in the IP header.

This is enough for this section, we have talked about the idea of the IP address, why it’s required, how the IP packet is developed and the functionality of every fiend in the IPv4 Header. If you have any suggestions or thoughts, just comment down below.

Related Concepts:

1. Understanding the Communication and Internet Beginning

2. Understanding the idea of Internet, OSI Model and TCP Model


  • , Understanding the IP address and IPv4 Packet Header, TechRX

    My name is Biplab Das. I’m a writer, Blogger, Youtuber and full time IT support engineer whose childhood obsession with science fiction never quite faded. A quarter-century later, the technology that I coveted as a kid is woven into the fabric of everyday life. People say smartphones are boring these days, but I think everyone is beginning to take this wonderful technology marvel for granted.

Related Articles

Leave a Reply

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

Back to top button