Subnet Masks

The particular location of the boundary marker within the 32-bit address is determined through the use of a subnet mask. The subnet mask is another 32-bit binary number that acts like a filter when it is applied to the IP address. By comparing a subnet mask with an IP address, systems can determine which portion of the IP address relates to the network and which portion relates to the host. Anywhere the subnet mask has a bit set to 1, the underlying bit in the IP address is part of the network address, while anywhere the subnet mask is set to 0, the related bit in the IP address is part of the host address.

For example, assume that the IP address of 11000000101010000000101000010100 has a subnet mask of 11111111111111111111111100000000. In this example, the first 24 bits of the 32-bit IP addresses are used to identify the network, while the last eight bits are used to identify the host on that network.

The size of the network—i.e., the number of devices that can be used on a particular network—is a function of the number of bits that are used to identify the host portion of the address. If a subnet mask shows that 24 bits are used for the network portion of the address, then there are only eight bits available for the host portion of the address block, allowing only 256 possible host addresses for that specific network. Similarly, if the subnet mask showed that 16 bits were used for the network, then the remaining 16 bits can be used for the host portion of the address ...

Get Internet Core Protocols: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.