Step-by-Step tutorial by expert to understand IP adressing and subnetting (CCNA context) Part-II(Subnetting)
Topic: Subnetting a network An step-by-step tutorial with examples for IP addressing and sub-netting.
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. ==================================================
After getting the number of subnets and hosts per subnet, we have to find the valid host range in each subnet and network and broadcast address for each subnet. To get all these information, we have to get a block size. We get block size by subtracting decimal value of the subnet bits from the maximum value of the octet, that is 2^8 is equal to 256. So here Block size is equal to 256 - 192 = 64. In this case, 192 is the decimal value of the two subnet bits turned on. Once we get a block size, that block size becomes the network address of the first valid subnet. Add block size to the first valid subnet and it gives you the network address of the second subnet. Keep on adding the block size to next subnet until the value reaches to equal to all subnet bits turned "on", which is 192 in our case. So we cannot use this last subnet. So we got two valid subnets, i.e., subnet 64 and subnet 128. The valid IP range for the subnet 64 is from 192.168.0.65 to 192.168.0.126. The network address for this subnet is 192.168.0.64 and broadcast address is 192.168.0.127. We cannot assign these network and broadcast addresses to the system. The valid IP range for the subnet 128 is from 192.168.0.129 to 192.168.0.190. The network address for this subnet is 192.168.0.128 and the broadcast address is 192.168.0.191. =====================================================
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 184.108.40.206/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. ==================================================
The number of hosts per subnet = 2^r-2 = 2^5-2 = 30. So we divided one big network into six smaller sub networks with 30 hosts each. Next let us calculate the block size. Block size = 256 - 224 =32. Here 224 is the decimal value of the subnet bits i.e., the number of bits we have taken from the host. Now start from the block size and keep on adding itself to next block till it reaches to maximum i.e., 224 which we cannot use. So we got the blocks of 32, 64, 96, 128, 160 and 192. The valid IP address in first subnet starts from 220.127.116.11 to 18.104.22.168, the network address for this subnet 32 is 22.214.171.124 and the broadcast address 126.96.36.199. The valid IP addresses in subnet 64 starts from 188.8.131.52 to 184.108.40.206, the network address for this subnet is 220.127.116.11 and the broadcast address is 18.104.22.168. The valid IP addresses in subnet 96 starts from 22.214.171.124 to 126.96.36.199, the network address for this subnet is 188.8.131.52 and the broadcast address is 184.108.40.206. The valid IP addresses in subnet 128 starts from 220.127.116.11 to 18.104.22.168, the network address for this subnet is 22.214.171.124 and the broadcast address is 126.96.36.199. The valid IP addresses for the subnet 160 are from 188.8.131.52 to 184.108.40.206, the network address is 220.127.116.11 and the broadcast address is 18.104.22.168. The valid IP addresses for the subnet 192 starts from 22.214.171.124 to 126.96.36.199, the network address for this subnet is 188.8.131.52 and the broadcast address is 184.108.40.206. ==================================================
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.
Definitely we are able to save lot of IP addresses in the example but you can observe that we are still losing a lot of IP addresses. We know that on the network-1 and network-2 side, we may use all the IP addresses in the subnet, but what about router to router interfaces..? We are never going to use more than two IP address on the point to point serial link between two routers. So if our sub-networks are having 30 hosts each, we are utilizing only two IP addresses per subnet out of 30. Again we are losing almost 28 IP addresses per router to router interfaces. To save IP addresses which are being wasted this way, we use a concept called VLSM or classless routing. VLSM stands for Variable Length Subnet Mask. In classless routing we assign variable length subnet mask to different interfaces of the routers. The contrary of the classless routing is class full routing where every interface of the routers are having same subnet mask. By using classless routing we use different subnet mask for the router to router interfaces and some other subnet mask for the hosts side. ====================================================
Now you can see that we are using different subnet mask for the router to router interfaces and router to host interfaces. For router to router interfaces we are using slash 30 subnet masks, which provides only two IP addresses per subnet while the router to hosts side we are using slash 27 which is providing 30 hosts per subnet.
Now let us subnet a class B network.
We have a requirement of total of 13 subnets with minimum of 4000 hosts per subnet. We are using the class B network 220.127.116.11. How many bits should we take from host portion to fulfill the above requirements? If we take two bits, we will be getting 2^2-2= 2 subnets. But we need 13 subnets. So if we take 5 bits then we will get 2^5-2=30 subnets. Great we are getting more than what we needed. But what about hosts. Just let us calculate. Since it is a class B network, the total number of host bits is 16, out of which we have taken 5 bits for sub-netting. So the number of hosts per subnet will be 2^11-2=2046. But we require at least 4000 hosts per subnet. So let us try once again. If we take 4 bits from hosts then? Let's calculate. ===================================================
If we take four bits from host portion, then total number of network bits becomes 20. The new subnet mask for each subnet will be 255.255.240.0. Number of subnets = 14 and number of hosts/subnet we get 4094. Exactly what we needed. So four bits extra solves our problem. One more important thing you should know that the representation of network addresses like 18.104.22.168/20 is referred as CIDR notation. CIDR stands for classless inter-domain routing.
Now we are going to discuss another important term related to IP addressing, "Super-netting". You will be wondering what is this new term? Very simple, remember what is sub netting? Division of one large network into multiple smaller sub-networks. And super-netting? Grouping multiple networks into larger super networks. Confused. We discussed that sub-netting is done to save the IP addresses, so super-netting is contrary to that, it will waste IP addresses, if use on client side. So why do we need super-netting? Well it is used by ISP's for route summarization. We do route summarization to bring down the number of routing table entry in the internet routers. As you should know that internet routers must have every network route entry into its routing table, in order to route packets to every possible destination. Routers simply drop packets if they don't find the destination network in the routing table. So internet routers will have to maintain routing table entry of every possible network around the world in order to provide connectivity from anywhere around the world to any site. This will lead to hundreds of thousands of routing table entry. The result of so many routing table entry will be slowed down routing performance, since routers will have to read through the very long list of routing table to find out the destination network before it can forward the data packets on outbound interface. Hence to reduce the number of routing table entry the ISP's gets assigned a large pool of IP addresses as super-nets. ===================================================
Here you can see in the illustration, a large ISP has got 22.214.171.124/22 super-net assigned. The large ISP is assigning small networks within the super-net to small ISP's. The small ISP's are further dividing the networks into sub-nets and then assigning to the customers. Important thing to notice here is that all the networks including sub-nets under the large ISP is represented as single super-net 126.96.36.199/22 to the internet. When ever any data packets arrive to the internet router for any small ISP's customers, the internet router will simply send to the Large ISP. Internet routers will have to remember only large ISP's network and not every network under the large ISP; hence super-netting effectively solves the problem of large number of routing table entry into the internet routers. Representation of large number of networks as single super-net into the internet routers routing table is referred as route summarization, and the representation of super-nets in the form of 188.8.131.52/22 is referred as CIDR notation. CIDR stands for class less inter domain routing. So we learnt how super-netting brings down the number of routing table entry into the internet routers. Now we will learn how to create super-nets. ===================================================
Remember, for sub-netting, we take bits from host, but for super-netting we give bits to hosts. Just see the figures. We had a class C network 184.108.40.206/24 but we removed two bits from the network portion and added to host. Here removing means turning the network bits off. If you examine the figures closely, you will find that each super-net here is a combination of four class C networks. The first super-net is ranging from 220.127.116.11 - 18.104.22.168, which includes network 22.214.171.124, network 126.96.36.199, network 188.8.131.52, and 184.108.40.206. The same way every super-net out here consists of four class C networks with 1022 hosts per supernet.
For IP addressing, please select IP addressing and subnetting part-I
IP addressing and subnetting Part-I
More by this Author
The Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are the two most popular TCP/IP transport layer protocols. TCP/IP networking protocol developed in the 1970s by pioneering network engineers...
Written, Designed and Edited by: Aftab-tekdad First of all let us understand IP? IP stands for Internet Protocol. It is a part of TCP/IP stack. IP is a layer 3 protocol according to OSI reference model. IP is...