Internet Protocol Adressing

Currently there are two revisions of the Internet Protocol (IP) , IPv4 and IPv6. As IPv4 has adressing limitations and the world needs more and more computers and devices IPv6 has been introduced to overcome the IPv4’s limitations. IPv6 gradually replacing IPv4.

IPv4 Addressing

IPv4 Address has four octets seperate by a dot ‘.‘. Octets are shown as decimal values.
For example 192.168.1.1172.16.0.08.8.8.80.0.0.0 and 127.0.0.0

The IPv4 addresses consists of two parts, Network Part and Host Part. The Network Part provides the network identity. The Host Part represents a dedicated address to an individual computer or device on the given network.
The partitioning between the Network and Host parts as defined by a Subnet Mask. Smilar to IPv addresses, the Subnet Mask is also depicted as four octates seperated by a dot. Again, octets are shown as decimal values.
For example, 255.255.255.0, 255.0.0.0, 255.255.224.0, and 255.240.0.0 are valid Subnet Masks.

A computer or a device requires both an IP Address and a Subnet Mask to define its Network and IP identity on the Network.

Subnet Mask

The set bits (1 as binary) of the octets (representing the octets as binary values) of of a Subnet Mask is used to identify the network related bits of the IP address of the a computer or a device.

The network related set bits should start from the Left Most bits and extended to the right by setting the bits in the octests without leaving any bits left un-set, i.e. zero (0 as binary).

For example the Subnet Mask 255.255.0.0 can be depicted as 11111111.11111111.00000000.00000000 and it is a valid Subnet Mask in which there is no discontinuaty on the set bits(1) from the Left Most bit to the right most set bit.

Similarly. the Subnet Mask 248.0.0.0 can be represented in binary as 11111000.00000000.00000000.00000000 and it is a valid Subnet Mask.

Additionally, the Subnet Mask 255.255.255.192 can be shown in binary as 11111111.11111111.11111111.11111100 and its a valid Subnet Mask.

On the other hand, the 255.239.0.0 can be represented in binary as 11111111.11101111.00000000.00000000 and cannot be used as a Subnet Mask. The first zeroed bit from the left most breaks the continuity of set bits to the right.

Host ID and Network ID

With an associated Subnet Mask a IPv4 address can be split into Network ID and Host ID parts.

For example, IP: 10.1.0.1 and Subnet Mask: 255.255.0.0.
The computer’s or device’s Host ID is 0.0.0.1 and it works on the Network 10.1.0.0

Similarly, IP: 198.240.12.243 and Subnet Mask: 255.255.255.240. The computer or device ‘s host ID is 0.0.0.3 on the Network 198.240.12.240.

Subnet Mask Bit Notation

Instead of using two set of information IP address and Subnet Mask, the Bit Notation can be use to serve the same purpose.

In the Bit Notation IP: 10.1.0.1 and Subnet Mask: 255.255.0.0 are combined and given as 10.1.0.1/16
Here, IP: 10.1.0.1 and /16 represents the Left Most 16 set bits, i.e. in binary format 11111111.11111111.00000000.00000000 and in decimal format 255.255.0.0  

Subnet MaskSubnet Mask in BinaryBit Notation
255.0.0.011111111.00000000.00000000.00000000/8
255.255.0.011111111.111111111.00000000.00000000/16
255.255.255.011111111.111111111.11111111.00000000/24
255.255.240.011111111.111111111.11110000.00000000/20
192.0.0.011000000.00000000.00000000.00000000/2
224.0.0.011100000.00000000.00000000.00000000/3
252.0.0.011111100.00000000.00000000.00000000/6
Subnet Masks in Bit Notation

IPv4 Address Classes and Subnet Masks

There are five classes defined by the IPv4 named as A, B, C, D, and E. These classes defines the Network ID and Host ID ranges.

ClassSubnet MaskSubnet Mask Bit NotationFirst octet rangeFormat in binary
A255.0.0.0/81-1260nnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhhh
B255.255.0.0/16128-19110nnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhhh
C255.255.255.0/24192-223110nnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhhh
DReserved for Multicast groups N/A224-2391110[Multicast Address, 28 bits]
EReserved for future N/A240-2551111[Reserved, 28 bits]
IPv4 Address Classes, n: Network ID bits, h: Host ID bits

Network Address: if Host ID part is all zeros ‘0’, the IP address is called as Network Address which is not used by any host (computer or device).
Broadcast Address: if Host ID part is all ones ‘1’, the IP address is called as Broadcast Address which is not used by any host (computer or device), but listen to all host on the network.

Private IPv4 Addresses and Ranges

Private IP address rages are allocated for intranets to be used in private networks. These addresses are never seen on the Internet. As Internet routers do not pass packets that originate from these addresses.

ClassNetwork AddressSubnet MaskNo of networksNo of Hosts per Network
A10.0.0.0 to 10.255.255.255255.0.0.0, i.e. /812616,646,144
B172.16.0.0 to 172.31.255.255255.255.0.0, i.e. /1616,38365,024
C192.168.0.0 to 192.168.255.255255.255.255.0, i.e. /242,097,151254
LOOPBACK127.0.0.0 to 127.0.0.7255.255.255.0, i.e. /24

Public IP Addresses

The public IP address uniquely identifies every device directly connected to the Internet.

ClassNetwork AddressSubnet MaskNo of networksNo of Hosts per Network
A1.0.0.0 to 126.255.255.255255.0.0.0, i.e. /812616,777,214
B128.0.0.0 to 191.255.255.255255.255.0.0, i.e. /1616,38465,532
C192.0.0.0 to 223-255.255.255255.255.255.0, i.e. /242,097,152254
D224.0.0.0 to 239.255.255.255N/AN/AClass D is reserved for Multicasting for which multicasting data is not targetted to a particular host. Hence, there is no need to extract host address from the IP address, and Class D does not have any subnet mask.
E240.0.0.0.to 254.255.255.255N.AN/AClass E is reserved for experimental usage only. The class E does not have any subnet mask.
Public IP Addresses

See Also

An introduction to networking terminology interfaces and protocols

Understanding ip addresses subnets and CIDR notation for networking

IPv4 address ranges

Leave a Reply