Subnetting creates additional network IDs at the expense of host IDs and can be used with either A, B or C class addresses. If you look at Table 1, you will notice that a class B address uses 14 bits for network addressing and 16 bits for host addressing. By simply reassigning one of the host bits to a network bit, you would double the number of available network addresses but halve the number of host addresses. Carrying the argument further, move eight of the host bits (actually the complete third byte) to the network side. The result is 22 bits for network addressing and eight bits for host addressing which is quite similar to a class C address. These additional network addresses are called subnets and not networks because to the Internet, the original address is still a class B network address but locally the class B network address can be broken down to manageable subnets that function as actual network addresses. Why use subnets? Subnets are interconnected using routers, and routers improve network performance by reducing traffic and minimizing disruption due to broadcast messages. Large networks become more manageable when subnets are deployed.
Table 1 Address classes define the split between network and host IDs.
To create subnets you need a subnet mask
that defines which bits will be used to create the new network address out of the
32-bit IP addresses. By “ANDing” the 32-bit IP address with a 32-bit mask, we create a 32-IP address that represents <netid, subnetid> becoming our new network address. What do these masks look like? If we start with a basic class A address and do not define any subnets, the mask would look like 255.0.0.0 which is called a natural or default mask. Only those bits that are set as a 1 will be considered when defining a network address. In this case, all the bits in the first byte of the IP address will be considered. The natural mask for a class B address is 255.255.0.0 and for a class C address it is 255.255.255.0. In order to create more network addresses (subnets) we need to move the mask bits to the right (changing 0 bits into 1s) in order to convert host bits into network bits. The best way to understand the concept is to use an example.
Assume we begin with IP address 188.8.131.52. From Figure 1 we know that this is a class B address with a network address of 165.10 with the capability of assigning up to 65,534 hosts. We do not want 65,534 hosts on one network but would like to have up to 500 hosts on each subnet. In order to have 500 hosts on one subnet, we need to have 9 bits of host addressing. Currently, we have 16 bits of host addressing since we possess a class B address. That means that we can reassign 7 of those bits to signify subnet bits. Therefore, the subnet mask would be 255.255.254.0. In binary it would be: