Network Layer – IPv4 Address Formats
In the last post, we have seen IPv4 header format in detail. Now we have to understand the various addressing formats implemented in the network layer (in IPv4). The IPv4 protocol has an address space.
When any datagram is fragmented, each fragment has its own header with most of the fields repeated, but also with some change. A fragmented datagram may itself be fragmented .
In other words, we can say that a datagram can be fragmented several times before it reaches the final destination.
Communication is all about networking. Usually, every host communicates with each other via the internet. So there is indeed a need for a global scheme of addressing this.
We term this logical addressing in the network layer. Furthermore, we call this logical addressing as an IP address in the TCP/IP model.
The 32 bit IPv4 address is grouped into groups of eight bits, separated by dots. Each 8-bit group is then converted into its equivalent binary number.
Thus each octet (8 bit) can take value from 0 to 255. For example, the IPv4 address of ‘10010001 00001010 00100010 00000011’ is denoted in the dotted-decimal form as 145.10.34.3
IPv4 Address classes: (Classful Addressing)
IPv4 addressing mainly based on the concept of classes. The overall architecture is termed as Classful Addressing. In this, the complete address class is divided into 5 classes. The IPv4 addresses are classified into 5 types as follows :
- Class A
- Class B
- Class C
- Class D
- Class E
We can find the class of an address when given the address in binary format or dotted decimal format.
Class A format of IPv4 address
The network field is 7 bit long and the host field is of 24 bit length. So the network field can have numbers between 1 to 126. . But the host numbers ranging from 0.0.0.0 to 127.255.255.255 .
This is mainly meant for large organizations with a large number of attached hosts and routers. Thus in class A, there can be 126 types of networks and 17 million hosts. The “0” in the first field identifies that it is a class A network address.
A block in a class A address is too large for any organization . This basically means most of the addresses will be wasted and not at all used.
Class B format of IPv4 address
Class B addresses designed for midsize organizations with thousands of attached routers and hosts. The first two fields identify the network, and the number in the first field must be in the range 128 – 191. Class B networks are large.
Host numbers ranging from 0.0 and 255.255 are reserved, so there can be upto 65,534 (216-2) hosts in a class B network. Furthermost of the 16,382 class B addresses have been allocated.
The first block covers address from 128.0.0.0 to 128.255.255.255 and the last block covers from 191.255.0.0 to 191.255.255.255 .
A block of class B is also very large for many of the organizations that received a class B block .
Class C format of IPv4 address
The first block in class C covers addresses from 192.0.0.0 to 192.0.0.255 and the last block covers addresses from 223.255.255.0 to 223.255.255.255 .
Class C is probably too small for any organization.
Class D format of IPv4 address
The class format allows for upto 2 million networks with upto 254 hosts each and class D format allows the multicast in which a datagram is directed to multiple hosts . Class D addresses are designed for multicasting. Each address in this class used to define one group of hosts.
Class E format of IPv4 address
The class E addresses are reserved for future use, and only very few addresses actually used(again resulting in wastage of additional addresses).
This address begins with 11110 which shows that it is reserved for future use. The 32 bit (4 byte) network addresses are usually written in dotted decimal notation.
In this notation, each of the 4-bytes is written in decimal from 0 to 255. So the lowest IP address is 0.0.0.0 i.e. all the 32 bits are zero and the highest IPv4 address is 255.255.255.255 .
Note : In classful addressing , a large part of available addresses are wasted
In classful addressing, an IP address in class A, B and C is divided into netid and hostid. Both these parts will be of varying length and size depending upon the class of the address.
For eg , in class A, one byte defines netid and 3 bytes define hostid. In class B, 2 bytes define netid and 2 bytes defines hostid. For class C, 3 bytes define netid and 1 byte is for host id.
Special IP Addresses
All zeros means the host or the network and all 1’s means broadcast address to all hosts on the indicated network. The IP address 0.0.0.0 is used by the hosts when they are being booted but not used afterward.
The IP addresses with ‘0’ as the network number refer to their own network without knowing its number . The address having all ones is used for broadcasting on the local network such as a LAN.
Address Masks (Default Masks)
An address mask determines which portion of an IP address identifies the network and which portion will identify the host. Like IP address, the mask will be represented by four octets (an octet is an 8-bit binary number equivalent to a decimal number in the range 0 – 255).
If a given bit of the mask is 1, the corresponding bit of the IP address is in the network portion of the address, and if a given bit of the mask is 0, the corresponding bit of the IP address is in the host portion.
Classless Addressing
One way to overcome the limitations of classful addressing is to assign address blocks to hosts.In this method, there are no classes but the addresses are still granted in blocks.
In classless addressing , when any hosts is to be connected to the internet, that entity will be assigned with the block (range) of addresses . The exact range of addresses depends upon the size of the host entity.
Limitations of IPv4
The most obvious limitation of IPv4 is its address field. Each networked device has a unique IP address. IPv4 uses a 32-bit addressing scheme, which gives it 4 billion possible addresses.
With the proliferation of networked devices including PCs, cell phones, wireless devices, etc., unique IP addresses are becoming scarce, and the world could theoretically run out of IP addresses.
A network has slightly more number of hosts than a particular class, then it needs either two IP addresses of that class or the next class of IP address.
Other identified limitations of the IPv4 protocol are complex host and router configuration, non-hierarchical addressing, difficulty in re-numbering addresses, large routing tables, non·trivial implementations in providing security.
To overcome these problems the internet protocol version 6 (IPv6) which is also known as internet protocol, next generation (IPv6) was proposed. In IPv6 the internet protocol was extensively modified for accommodating the unforeseen growth of the internet.
Who Decides the IP Addresses ?
No two IP addresses should be same. This is ensured by a central authority that issues the prefix or the network number portion of the IP address.
Locally an ISP is to be contacted in order to get a unique IP address prefix. At the global level, the Internet Assigned Number Authority (lANA) allots an IP address prefix to the ISP.
Thus it is ensured that the IP addresses are not duplicated. Conceptually lANA is a wholesales and ISP is a retailer of the IP addresses because ISP purchases IP addresses from lANA and sells them to the customers.
Due to many shortcomings of IPv4 addressing , such as lack of support for real time secure audio and video contents, lack of authentication and encryption are some of the reasons to move towards the IPv6 form of addressing. Stay tuned to explore the next exciting topic in this series.
Aric is a tech enthusiast , who love to write about the tech related products and ‘How To’ blogs . IT Engineer by profession , right now working in the Automation field in a Software product company . The other hobbies includes singing , trekking and writing blogs .