I am writing this article to make you comfortable with analyzing existing subnet masks but you must know how to find the number of subnets, and the number of hosts per subnet, in a class full network that uses a single mask. This process uses only decimal math, but it relies on the memorization of the nine decimal values that can be used in a subnet mask as listed in this table:
You can determine several useful facts about a classful network when using a single mask throughout. In particular, you can find the number of possible subnets and the number of host addresses in each subnet. This article guides you through a binary process to find both facts. For reference:
To begin analyzing subnet masks in depth, we’ll take as example a single Class C network address (220.127.116.11) and show how a Class C custom subnet mask can be used to determine which subnetwork (or subnet) a host is on and to route packets from one subnetwork to another. Remember that with a Class C network address, the first 3 octets, or 24 bits, are assigned as the network address. This leaves one octet, or 8 bits, for hosts.
CCNA Training – Resources (Intense)
So, each Class C network could have up to 254 hosts:
28 = 256 – 2 = 254
Perhaps less than 254 hosts, workstations and servers combined are desired on one network. This could be for security reasons or to reduce traffic. It can be done by creating two sub networks and separating them with a router. This will create smaller independent broadcast domains which can improve network performance and increase security. Doing so is possible because these sub networks will be separated by one or more router.
Assume at least two sub networks will be needed and that there will be at least 50 hosts per subnetwork. Because there is only one Class C network address, only 8 bits in the fourth octet are available, for a total of 254 possible hosts. Therefore, a custom subnet mask must be created. The custom subnet mask will be used to borrow bits from the host portion of the address. The following steps help accomplish this:
- The first step to subnetting is to determine how many subnets are needed. In this case, it’s two subnetworks. To see how many bits should be borrowed from the host portion of the network address, add the bit values from right to left until the total is equal to or greater than the number of subnets needed. Because two subnets are needed, add the one bit and the two bit, which equals three. This is greater than the number of subnets needed. To remedy this, borrow at least two bits from the host address starting from the left side of the octet that contains the host address.
Network address: 18.104.22.168
4th octet Host address bits: 1 1 1 1 1 1 1 1
Host address bit values 128 64 32 16 8 4 2
Add bits starting from the right side, the 1 and the 2, until the sum is greater than the number of subnets needed.
Note: An alternate way to calculate the number bits to be borrowed for subnets is to take the number of bits borrowed to the power of 2. The result must be greater than the number of subnets needed.
As an example, if 2 bits are borrowed in the calculation, it’s two to the second power, which equals four. Since the number of subnets needed is just two, this should be adequate.
- After we know how many bits to borrow, we take them from the left side of the host address, the 4th octet. Every bit borrowed from the host address bit leaves fewer bits for the hosts. Even though the number of subnets is increased, the number of hosts per subnet is decreased. Because two bits need to be borrowed from the left side, that new value must be shown in the subnet mask.
The existing default subnet mask was 255.255.255.0 and the new custom subnet mask is 255.255.255.192. The 192 comes from adding the first two bits from the left, 128 + 64 = 192. These bits now become 1s and are part of the overall subnet mask. This leaves 6 bits for host IP addresses or 26 = 64 hosts per subnet.
4th Octet borrowed bits for subnet: 1 1 0 0 0 0 0 0
Subnet bit values: (from left side) 128 64 32 16 8 4 2 1
With this information, the following table can be built. The first two bits are the subnet binary value. The last 6 bits are the host bits. By borrowing 2 bits from the 8 bits of the host address, 4 subnets with 64 hosts each can be created. The 4 networks created are as follows:
- The 22.214.171.124 network
- The 126.96.36.199 network
- The 188.8.131.52 network
- The 184.108.40.206 network
The 220.127.116.11 network is considered unusable, unless the networking device supports the IOS command ip subnet-zero, which allows using the first subnet.
Table 3: Notice how the subnet starts…
Notice that the first subnet always starts at 0 and, in this case, increases by 64, which is the number of hosts on each subnet. One way to determine the number of hosts on each subnet, or the start of each subnet, is to take the remaining host bits to the power of 2. Because we borrowed two of the 8 bits for subnets and have 6 bits left, the number of hosts per subnet is 26 or 64.
Another way to figure out the number of hosts per subnet or the increment from one subnet to the next is to subtract the subnet mask value in decimal, 192 in the fourth octet, from 256, which is the maximum number of possible combinations of 8 bits. This equals 64. This means we start at 0 for the first network and add 64 for each additional subnetwork. For example, if the second subnet is used, the 18.104.22.168 network can’t be used for a host ID since the network ID of the 64 subnet has all zeros in the host portion.
Another common way to represent a subnet mask is the use of the “slash/number” (/#) where the # following the slash is the number of bits used in the mask (network and subnet combined).
As an example, a Class C network address such as 22.214.171.124 with a standard subnet mask (255.255.255.0) would be written as 126.96.36.199 /24, indicating that 24 bits are used for the mask. The same network, when subnetted by using two host bits for subnets, would be written as 188.8.131.52 /26. This indicates that 24 bits are used for the network and 2 bits for the subnet. This would represent a custom subnet mask of 255.255.255.192 in dotted decimal format.
A Class A network of 10.0.0.0 with a standard mask (255.0.0.0) would be written as 10.0.0.0 /8. If 8 bits (the next octet) were being used for subnets, it would be written as 10.0.0.0 /16. This would represent a custom subnet mask of 255.255.0.0 in dotted decimal format. The “slash” number after the network number is an abbreviated method of indicating the subnet mask being used.
Tips for Cisco exams and actual job environments:
Apply the described technique to analyze the subnet masks. So, take a pen and paper, make your own network and apply subnetting according to your requirements. Then go through the whole process and you will find how all things become easy with these techniques. Try the same practice using different IPs of different classes.
I hope that this article and others like it would enable you to understand the important topics of IPv4 addressing and subnetting better. If you have any queries regarding this article, feel free to use the @comment box below, and I will try my best to give you a quick reply.
- Guide to Cisco Certified Network Associate certification by Todd Lamlee, Sybex press.
- Guide to Cisco Certified Network Associate by Richard Deal.
- Cisco Certified Network Professional-Route by Wendell Odom, Ciscopress.com
- CCNP- Route Quick reference by Denis Donohue, Ciscopress.com
- Cisco Certified Internetwork Expert by Wendell Odom and others, Ciscopress.com
- Cisco Certified Internetwork Expert Quick reference by Brad Ellis, Ciscopress.com