Prefix, network, broadcast and host address

The Prefix Length

Expressing network and host addresses with the dotted decimal subnet mask address is difficult. So, convert the dotted-decimal representation of the subnet mask to binary and count the number of adjacent 1s bits, starting at the most significant bit in the first octet. The number of 1s in the subnet mask is called a prefix. The prefix is written in “slash notation”, a “/” followed by the number of bits set to 1 in the subnet mask. For example, calculate the prefix length if the subnet mask is 255.255.128.0.

255.255.128.0   in binary 11111111.11111111.10000000. 00000000, now count the 1s from the left side, which is 17, so the prefix length is /17. We can easily calculate the subnet mask from prefix length.  For example, if the prefix length is /20, the total number of 1s in the subnet mask is 20. So write 1 twenty times followed by twelve 0s, 11111111.11111111.11110000. 00000000. Now convert the binary number into a decimal dotted notation, which is 255.255.240.0. We can manage a table for all possible prefixes.

The table below illustrates all possible prefixes for 32-bit addresses, including their subnet mask, both in binary and decimal. The first column lists all possible prefixes. The second column displays the binary value of the prefix, and the last column displays the resulting subnet mask.

Prefix-lengthBinary value for the prefix-lengthThe Subnet Mask
/811111111.00000000.00000000.00000000255.0.0.0
/911111111.10000000.00000000.00000000255.128.0.0
/1011111111.11000000.00000000.00000000255.192.0.0
/1111111111.1110000.00000000.00000000255.224.0.0
/1211111111.11110000.00000000.00000000255.240.0.0
/1311111111.11111000.00000000.00000000255.248.0.0
/1411111111.11111100.00000000.00000000255.252.0.0
/1511111111.11111110.00000000.00000000255.254.0.0
/1611111111.11111111.00000000.00000000255.255.0.0
/1711111111.11111111.10000000.00000000255.255.128.0
/1811111111.11111111.11000000.00000000255.255.192.0
/1911111111.11111111.11100000.00000000255.255.224.0
/2011111111.11111111.11110000.00000000255.255.240.0
/2111111111.11111111.11111000.00000000255.255.248.0
/2211111111.11111111.11111100.00000000255.255.252.0
/2311111111.11111111.11111110.00000000255.255.254.0
/2411111111.11111111.11111111.00000000255.255.255.0
/2511111111.11111111.11111111.00000000255.255.255.128
/2611111111.11111111.11111111.11000000255.255.255.192
/2711111111.11111111.11111111.11100000255.255.255.224
/2811111111.11111111.11111111.11110000255.255.255.240
/2911111111.11111111.11111111.11111000255.255.255.248
/3011111111.11111111.11111111.11111100255.255.255.252

Network Address

A network address is the first logical address of the network that uniquely identifies a network or a subnet. An IP address combines two separate addresses: the network address and the host address. But if we eliminate the host address from the IP address, the remaining address will be the network address. In other words, a network address is an IP address without a host address or an IP address in which all host bits are turned 0s.

We can find the network address applying the logical AND process between the binary representation of the IP address and subnet mask. Align the bits in both addresses, and perform a logical AND on each pair of the respective bits. Then convert the individual octets of the result back to decimal. For example, if we have a host IP address 172.100.20.50 and the subnet mask is 255.255.128.0 calculate the network address for the IP address. The figure below illustrates the solution to the above example.

prefix

Broadcast Address

The broadcast address is the last logical address in the network or a subnet, and it is used to address all the nodes in the network simultaneously. This is a unique address that communicates with all hosts in a network. For example, when a host sends a packet to the network broadcast address, all hosts in the network will receive the packet. The broadcast address uses the highest address in the network range. The broadcast address has all 1s in the host portion. For example, find the broadcast address if the IP address is 172.100.20.0 and the subnet mask is 255.255.128.0. The figure below illustrates the solution to the above example.

broadcast

Host Address

The host address uniquely identifies the host in the network. The host portion always contains various 0s and 1s but never all 0s or all 1s.

First Host Address

The network’s first available host IP address has all 0s and ends with a 1 in the host portion. It is also called the first usable IP address.

Example

 Dotted Decimal NotationBinary
Network IP Address172.100.0.0/1710101100.01100100.00000000.00000000
First Usable IP address172.100.0.110101100.01100100.00000000.00000001

Last Host Address

The last available host IP address in that network which has 1s and ends with a 0 in the host portion. It is also called the last usable IP address.

Example

 Dotted Decimal NotationBinary
Last Usable IP Address172.100.127.25410101100.01100100.01111111.11111110
Broadcast IP Address172.16.127.25510101100.01100100.01111111.11111111