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-length | Binary value for the prefix-length | The Subnet Mask |
/8 | 11111111.00000000.00000000.00000000 | 255.0.0.0 |
/9 | 11111111.10000000.00000000.00000000 | 255.128.0.0 |
/10 | 11111111.11000000.00000000.00000000 | 255.192.0.0 |
/11 | 11111111.1110000.00000000.00000000 | 255.224.0.0 |
/12 | 11111111.11110000.00000000.00000000 | 255.240.0.0 |
/13 | 11111111.11111000.00000000.00000000 | 255.248.0.0 |
/14 | 11111111.11111100.00000000.00000000 | 255.252.0.0 |
/15 | 11111111.11111110.00000000.00000000 | 255.254.0.0 |
/16 | 11111111.11111111.00000000.00000000 | 255.255.0.0 |
/17 | 11111111.11111111.10000000.00000000 | 255.255.128.0 |
/18 | 11111111.11111111.11000000.00000000 | 255.255.192.0 |
/19 | 11111111.11111111.11100000.00000000 | 255.255.224.0 |
/20 | 11111111.11111111.11110000.00000000 | 255.255.240.0 |
/21 | 11111111.11111111.11111000.00000000 | 255.255.248.0 |
/22 | 11111111.11111111.11111100.00000000 | 255.255.252.0 |
/23 | 11111111.11111111.11111110.00000000 | 255.255.254.0 |
/24 | 11111111.11111111.11111111.00000000 | 255.255.255.0 |
/25 | 11111111.11111111.11111111.00000000 | 255.255.255.128 |
/26 | 11111111.11111111.11111111.11000000 | 255.255.255.192 |
/27 | 11111111.11111111.11111111.11100000 | 255.255.255.224 |
/28 | 11111111.11111111.11111111.11110000 | 255.255.255.240 |
/29 | 11111111.11111111.11111111.11111000 | 255.255.255.248 |
/30 | 11111111.11111111.11111111.11111100 | 255.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.
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.
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 Notation | Binary | |
Network IP Address | 172.100.0.0/17 | 10101100.01100100.00000000.00000000 |
First Usable IP address | 172.100.0.1 | 10101100.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 Notation | Binary | |
Last Usable IP Address | 172.100.127.254 | 10101100.01100100.01111111.11111110 |
Broadcast IP Address | 172.16.127.255 | 10101100.01100100.01111111.11111111 |