The Prefix Length
Expressing network addresses and host addresses with the dotted decimal subnet mask address is very 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 called prefix. The prefix is written in “slash notation”, which is a “/” followed by the number of bits set to 1 in the subnet mask. For example, if the subnet mask is 255.255.128.0 calculate the prefix length.
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, it’s mean that total numbers of 1s in the subnet mask are 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 its 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|
A network address is the first logical address of the network that uniquely identifies a network or a subnet. An IP address is the combination of two separate addresses, the network address and 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 184.108.40.206 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.
The broadcast address is the last logical address in the network or a subnet, and it is used for addressing all the nodes in the network at the same time. This is a special address 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, if the IP address 220.127.116.11 and the subnet mask is 255.255.128.0 find the broadcast address. The figure below illustrates the solution to the above example.
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 first available host IP addresses in that network which has all 0s and end with a 1 in the host portion. It is also called the first usable IP address.
|Dotted Decimal Notation||Binary|
|Network IP Address||18.104.22.168/17||10101100.01100100.00000000.00000000|
|First Usable IP address||22.214.171.124||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.
|Dotted Decimal Notation||Binary|
|Last Usable IP Address||126.96.36.199||10101100.01100100.01111111.11111110|
|Broadcast IP Address||172.16.127.255||10101100.01100100.01111111.11111111|