**Subnetting Examples**

Let's go over a few examples, but this time we're going to use a real network. If you have GNS3 or your own equipment then feel free to recreate the network it test it out. In the following image we have a basic network that has been assigned a class C address.

As you can see from the picture we need 3 subnets, 1 subnet for each of the host subnets connected to the routers, and 1 subnet connecting the routers to each other. Notice that we need at least 35 hosts on the subnet connected to router 2. I should note that we actually need 36 IP addresses for that subnet since the interface on the router has to have an IP as well.

We will start off by figuring out what mask allows at least 36 hosts and provides 3 subnets. Lets start by finding a mask to support the right number of hosts. Lets take a look at the 255.255.255.240 mask, it gives us 4 host bits and 4 subnet bits. If we plug the numbers into our formulas we get 2 to the 4th power - 2 = 14 hosts per subnet. That immediately tells us that we need a different mask with more host bits to support our needs. Lets remove 2 subnets bits which adds 2 bits to the host portion. We plug in the number of host bits in the mask now and we get 2 to the 6th power - 2 = 62 hosts. Great 62 hosts is more than enough with a mask that has 6 host bits, which is the 255.255.255.192 mask. The last thing we need to find out is the number of subnets we created. Plugging in the numbers we get 2 to the 2nd power = 4 subnets. Perfect, we need at least 3 subnets with at least 36 hosts per.

In the following image you can see how the network would be addressed with 3 subnets.

We will start off by figuring out what mask allows at least 36 hosts and provides 3 subnets. Lets start by finding a mask to support the right number of hosts. Lets take a look at the 255.255.255.240 mask, it gives us 4 host bits and 4 subnet bits. If we plug the numbers into our formulas we get 2 to the 4th power - 2 = 14 hosts per subnet. That immediately tells us that we need a different mask with more host bits to support our needs. Lets remove 2 subnets bits which adds 2 bits to the host portion. We plug in the number of host bits in the mask now and we get 2 to the 6th power - 2 = 62 hosts. Great 62 hosts is more than enough with a mask that has 6 host bits, which is the 255.255.255.192 mask. The last thing we need to find out is the number of subnets we created. Plugging in the numbers we get 2 to the 2nd power = 4 subnets. Perfect, we need at least 3 subnets with at least 36 hosts per.

In the following image you can see how the network would be addressed with 3 subnets.

We can see that we have applied our first 3 subnets to the network. The network connecting the 2 routers together is using the first subnet, 192.168.1.0/26. The second subnet is applied to the host network connected to router 1, this subnet is 192.168.1.64/26. And the third subnet is connected to the host network connected to router 2 with the 192.168.1.128/26 subnet.

This whole process would have been a LOT easier if we had the subnetting chart available. If you look at the chart below again and simply follow the # of Hosts field until you find a mask that supports what we need. Doing this the first mask we come to would be the 255.255.255.128 mask, but if we look at how many C subnets this creates we find only 2 which is not enough to support our 3 subnets. The next mask is the 255.255.255.192 which is the mask we ended up choosing. We see from the chart that it provides all the appropriate hosts and subnets.

This whole process would have been a LOT easier if we had the subnetting chart available. If you look at the chart below again and simply follow the # of Hosts field until you find a mask that supports what we need. Doing this the first mask we come to would be the 255.255.255.128 mask, but if we look at how many C subnets this creates we find only 2 which is not enough to support our 3 subnets. The next mask is the 255.255.255.192 which is the mask we ended up choosing. We see from the chart that it provides all the appropriate hosts and subnets.