# Step-by-Step tutorial by expert to understand IP adressing and subnetting Part-II

Subnetting a network An step-by-step tutorial with examples for IP addressing and sub-netting.

Subnetting:

To divide a large network into smaller sub-networks, we have to simply turn some of the host bits on in the subnet mask, thus increasing the number of sub-networks and decreasing the number of hosts per sub-networks. Here we are dividing a class C network into 2 smaller sub-networks by turning two host bits on in the subnet mask. It means now we are having 26 bits reserved for the network addressing and only 6 bits remaining for the host addressing. The formula to get the number of subnets is:
No. of subnets is equal to 2^n-2, where “n” is the number of bits taken from host. So here in our case we have taken 2 bits from the host, thus we get total of two subnets. In fact we get total of four subnets, but according to RFC which stands for Request For Comment and is the documentation of TCP/IP, we cannot use the first subnet because all the subnet bits are turned “off” in the first subnet and we cannot use the last subnet, because all the subnet bits are turned “on” at the same time, however Cisco routers does allow 1st subnet to be used by issuing an IOS command “ip subnet zero”. Here just remember that the subnet bits refer to the number of bits taken from the host. So we have to subtract all subnet bits on and all subnet bits off. Practically we can use all the subnets, but from CCNA exam point of view we cannot use 1st and last subnet.
Now the No. of hosts per subnet is equal to 2^r -2, where “r” is the number of bits remaining for the host. So 2^r-2 is equal to 2^6-2 is equal to 62. So we get total of two subnets with 62 hosts per subnet.
=========================================================================
=====================================================================================================================
First of all let us write the subnet mask. Since it is class C address, the default subnet mask length is 24 bits. And we have taken 3 bits extra from the host portion. Now we have total of 27 bits for network addressing. If you remember earlier lessons, you will be able to calculate that up-to 24 bits continuous “on” in subnet mask will be represented as 255.255.255.0, but we have taken 3 bits extra from the fourth octet. So the decimal value of the three bits from the left will be 224. Hence new subnet mask for the network 202.10.4.0/27 will be 255.255.255.224. It’s important to remember that all the subnets will have the same subnet mask. Now let us calculate the number of subnets. Here the number of subnets =2^n-2 = 2^3-2 = 6. So we got six smaller networks or subnets out of dividing a single class C network. Now let us calculate the number of hosts per subnet.
======================================================================================================================
======================================================================================================================
Now you can see that we have divided single class c network into six sub-networks. And we are using five subnets out of six on different interfaces of the router. Every sub net is having the same subnet mask that is /27. If you remember earlier IP address assignment, we were losing almost 1212 IP addresses out of 1270. Now after sub-netting, we are saving almost 4*254=1016+30= 1046 IP addresses. Well that’s really a huge saving.