In IP, each end node is uniquely identified by its IP address, whether the end node is part of a public or a private network. This post gives a brief overview of the structure of the IPV4 address.
- An IPV4 address consists of 4 bytes in the form a.b.c.d (E.g. 220.127.116.11, 18.104.22.168).
- It can be logically divided into a network and a host portion. While the network portion identifies the network to which the end node belongs to, the host portion uniquely identifies the end node, from the other end nodes, inside the network.
- IPV4 addressing supports two forms, namely class based and classless based, though class based approach is outdated.
Class Based IP addresses
In class based IP address types, the set of IP addresses are segregated into 5 classes of IP address families, namely class A, class B, class C, class D and class E, as given in the diagram below.
The above method of classification is based on two things,
- namely a unique binary prefix for each class (for e.g. all Class D addresses start with the prefix 1110) and
- the number of bits allocated to the network portion (Class A has the first byte reserved for network portion, Class B has the first two bytes reserved for the network portion and class C has the first three bytes reserved for the network portion). So Class A is generally used for big networks with large number of hosts (24 bits allotted to host), class B for medium sized networks and Class C for small networks.
- While Class A, B and C are used for normal Unicast communication, Class D addresses are reserved for multicast communication and Class E is reserved for future use and experimentation purposes.
Private IP addresses
A small portion of IP addresses, from Class A, Class B and Class C are reserved for use in private networks and cannot be used on the public Internet. The range of private IP addresses are given below:
Private IP address ranges
- 10.0.0.0 to 10.255.255.255 (Class A private IP addresses)
- 172.16.0.0 to 172.31.255.255 (Class B private IP addresses)
- 192.168.0.0 to 192.168.255.255 (Class C private IP addresses)
IP addresses with special interpretation/meaning
Certain types of IP addresses have special meaning. Some of these special types are illustrated in the diagrams given below:
As shown in the diagram above,
- the all zero (0.0.0.0) address is used to denote “this machine”, meaning that the packet originated or is destined for this machine.
- the 0.0.x.x address is used within a network to address a specific machine within this network.
- the all ones (255.255.255.255) special IP address is used for local broadcast purposes to send a packet to all machines within a network
- the x.x.255.255 special address is used to send a broadcast packet to all machines inside the remote x.x network
- the 127.x.x.x loopback address is used to loopback a packet back to the originating machine itself. A packet with a loopback destination IP address never leaves the machine where it originates. It is mainly used for testing purposes.
Classless IP addresses
Classful IP addresses is no longer popular and instead has been replaced with the concept of classless IP address, where there is no concept of IP address classes and no strict network and host boundaries.
In classless IP addressing
- There is no concept of Classful addressing like Classes A, B, C, D and E.
- IPV4 address range 0.0.0.0 to 22.214.171.124 treated as a single class
- No strict 8 byte boundaries for the network and host portions
- A Subnet masks defines network & host boundaries
- Very useful for optimizing address usage
- Examples of Classless Addressing
- Network address – 126.96.36.199 /16
- Network address – 188.8.131.52 / 21
- In the above address, 16 and 8 denote the subnet masks respectively. This means that in the first address 184.108.40.206, the first 16 bits are reserved for the network portion and the rest of the 16 bits are reserved for the host portion. Similarly in the second address 220.127.116.11/21, the first 21 bits are reserved for the network portion and the remaining 13 bits are reserved for the host portion
Thus it can be seen that classless addressing gives a flexible boundary between the network and host portions, thereby allowing lot of flexibility in partitioning the networks.