The best way to demonstrate subnetting method is by using an example. For example, we are given a network address 192.168.116.0 with the default subnet mask of 255.255.255.0. The requirement is to perform subnetting such that we create as many subnets as we can with 30 hosts in each subnet.
Our First step will be to determine how many bits do we need to borrow from the host portion such that the requirement of minimum 30 hosts per subnet is fulfilled. Using the formula below
Where the exponent n is equal to the number of bits left after subnet bits are borrowed.
we can calculate how many bits will be required so that each subnet has 30 host addresses. 25 -2 =30, so 5 bits at least must be available for host addressing and the remaining can be borrowed to create subnet addresses. The -2 in the formula accounts for two addresses the subnetwork address and the broadcast address which cannot be assigned to hosts.
The network 192.168.116.0/24 has 8 bits for host portion and we will reserve 5 bits for the new host portion, the 3 bits remaining can now be used for creating subnets. To determine how many subnets we can
create, use the following formula:
2n = number of subnets
where the exponent n is bits borrowed from the host portion.
Thus, in this case, we can create 23 =8 subnets
Our second step will be to calculate the new subnet mask, our previous subnet mask was 255.255.255.0 or 11111111.11111111.11111111.00000000 in binary. Since we have borrowed 3 bits from the host portion our new subnet mask will be 11111111.11111111.11111111.11100000 which is 255.255.255.224 when converted to decimal notation.
We have discussed in detail the conversion process of binary to decimal and vice versa. When performing IP subnetting we will refer to the picture shown below which is very handy in this process.
So our original subnet mask was 255.255.255.0 and we allocated 3 bits from the host portion which allowed us to have 8 subnets and 30 hosts within each subnet. We can quickly convert 255.255.255.0 to binary by looking at the table above. An octet which is 255 in decimal will be 11111111 in binary so 255.255.255.0 will be 11111111. 11111111. 11111111.00000000. We will set the first 3 bits of the last octet to 1 and the last octet will now be 11100000 which from the table above will be 224 in decimal. So our new subnet mask is 255.255.255.224
Our third step will be to determine the subnet multiplier which is fairly simple. All we have to do is subtract the last nonzero octet of the subnet mask from 256. So in this case our subnet multiplier will be 256-224 =32. We will use the subnet multiplier in the next step to list the subnets.
Our final step will be to list the subnet address, host range, and the broadcast address. The first subnet address will be 192.168.116.0/27 and the following subnets will be with increments of 32, the subnet multiplier we calculated in the previous step.
Shown in the table below are the subnet addresses, their respective host ranges and the broadcast addresses.
|Subnet Address||Host Range||Broadcast Address|
|192.168.116.96/27||192.168.116.97 – 192.168.116.126||192.168.116.127|
|192.168.116.128/27||192.168.116.129 – 192.168.116.158||192.168.116.159|
|192.168.116.160/27||192.168.116.161 – 192.168.116.190||192.168.116.191|
|192.168.116.192/27||192.168.116.193 – 192.168.116.222||192.168.116.223|
|192.168.116.224/27||192.168.116.225 – 192.168.116.254||192.168.116.255|
As shown in the table, once we have listed the subnet addresses, calculating the host range and broadcast address is relatively simple. The broadcast address will be the last address of the subnet and one less the preceding subnet address. For example, for the subnet 192.168.116.0/27 the broadcast address will be 192.168.1.31 which is the last address of this subnet and in binary it will be all 1s in the host portion, this address is preceded by the next subnet address.
The host range will start from the next address after the subnet address for example for the subnet 192.168.116.32/27 the host range will start at 192.168.116.33 and end at one less the broadcast address which will be 192.168.116.62 since the broadcast address is 192.168.1.63. The host address must exactly be 30 in number since we have reserved 5 bits for the host portion.
The methods shown above to calculate the range of valid host IP addresses and the broadcast address are very easy and quick. We will also learn another way to perform these calculations.
To calculate the broadcast address of a subnet change all the host bits values in the subnet address to binary 1s. For example, if we need to find the broadcast address of the subnet 192.168.116.32/27 we will first list the subnet address in binary, (we have previously discuses the mathematical conversion process in a previous article). So 192.168.116.0/27 will result in 11000000.10101000.01110100.00100000. Then we will change all host bits values to binary 1s which will be 11000000.10101000.01110100.00111111. So now we have the broadcast address in binary. Converting this to decimal will result in 192.168.116.63.
We can also calculate a range of valid host IP addresses in a subnet using the binary method. For example, if we need to calculate the range of host addresses in the subnet 192.168.116.32/27 we will first find the first usable host IP address by changing the right-most host bit to 1 of the subnet address. Our subnet address in binary is 11000000.10101000.01110100.00100000 and when we change the right-most host bit to 1 it will be 11000000.10101000.01110100.00100001 which is 192.168.116.33, this is our first usable host IP address of the subnet. Now we will find the last usable host IP address of the subnet by changing all host bits in the subnet address to 1 except for the right-most host bit which will be 11000000.10101000.01110100.00111110, converting this to decimal will result in 192.168.116.62. So now we have the valid host IP address range for the subnet 192.168.116.32/27 which is from 192.168.116.33 to 192.168.116.62. It can also be confirmed from the table above.
This brings us to the end of this article in which we covered basic subnetting techniques. There are several techniques and each person has his favorite. The technique demonstrated in the article is a simple and quick technique of performing subnetting.
Out first octet 11000000 can be converted to a decimal by picking the bits which are 1 and adding the corresponding decimal values shown in the table above. So 11000000 will be 128 + 64 = 192.
Similarly the second octet 10101000 will be 128 + 32 + 8 = 168, third octet 01110100 will be 64 + 32 +16 +4 = 116 and the finally the fourth octet 11010010 will be 128 + 64 + 16 + 2 = 210.
This results in the IP address 192.168.116.210.
This brings us to the end of this article in which we learn the architecture of IP addresses and also explained the purpose of a subnet mask. We also covered a very important tutorial on binary to decimal conversion and vice versa. It is very important to have firm concepts as these are the base for the entire upcoming CCNA lessons.