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 22.214.171.124/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 126.96.36.199 to 188.8.131.52, the network address for this subnet 32 is 184.108.40.206 and the broadcast address 220.127.116.11. The valid IP addresses in subnet 64 starts from 18.104.22.168 to 22.214.171.124, the network address for this subnet is 126.96.36.199 and the broadcast address is 188.8.131.52. The valid IP addresses in subnet 96 starts from 184.108.40.206 to 220.127.116.11, the network address for this subnet is 18.104.22.168 and the broadcast address is 22.214.171.124. The valid IP addresses in subnet 128 starts from 126.96.36.199 to 188.8.131.52, the network address for this subnet is 184.108.40.206 and the broadcast address is 220.127.116.11. The valid IP addresses for the subnet 160 are from 18.104.22.168 to 22.214.171.124, the network address is 126.96.36.199 and the broadcast address is 188.8.131.52. The valid IP addresses for the subnet 192 starts from 184.108.40.206 to 220.127.116.11, the network address for this subnet is 18.104.22.168 and the broadcast address is 22.214.171.124. ==================================================
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 126.96.36.199. 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 188.8.131.52/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 184.108.40.206/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 220.127.116.11/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 18.104.22.168/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 22.214.171.124/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 126.96.36.199 - 188.8.131.52, which includes network 184.108.40.206, network 220.127.116.11, network 18.104.22.168, and 22.214.171.124. 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
Comments: Was the post useful? Dou you expect me to write post on specific topic?
buddhi on April 03, 2015:
can you help me plz
Nasrin on February 26, 2014:
255.100.77.21 -subnet mask.pls calculate subnet for 15 network
earl on February 09, 2014:
in need of some real help here. I have an assignment that i don't understand with subnetting. Im required to find these particluar subnet ranges and there broadcast addresses 18. 126.96.36.199/8 subnetted to 11280 subnets and provide information for subnets #1, #6811, #10229, and #11280.. I understand how to subnet but cant figure how to get the really high numbered subnets... any assistance would be greatly appreciated.
abay ja on February 04, 2014:
# of subnet = 2^n-2
# of subnet = 2^n
Hello on September 14, 2013:
So no of subnets = 2^2-2 = 2
anything to the power zero is one. . . how it is 2
Parveen on July 22, 2013:
dzahieda ismail on September 16, 2012:
A customer has called the ISP to design a network upgrade for an organization. The existing customer network supports two (2) subnets of up to 20 clients each and allows for growth to five subnets in the future. Use the 192.168.10.0 255.255.255.0 determine :
a. Based on the customer requirements, how many hosts must each subnet support?
b. How many subnets must there be to allow for future growth?
c. What is the new subnet mask in dotted decimal notation ?
d. New subnet mask in slash notation
e. Table of subnetting :
f. Range of valid IP Address for first subnet?
g. Network id for third subnets?
h. Broadcast IP Address for subnet number 2?
i. What is the total number of networks with this scheme?
j. What is the total number of hosts for each network?
k. How many IP Address that valid to use?
rzsink on July 19, 2012:
First IP Add-Last IP Add Subnet Mask
Subnet1: 188.8.131.52-184.108.40.206 25/ 255.255.255.128
Subnet2: 220.127.116.11-18.104.22.168 26/ 255.255.255.192
Subnet3: 22.214.171.124-126.96.36.199 27/ 255.255.255.224
Subnet4: 188.8.131.52-184.108.40.206 28/ 255.255.255.240
Subnet5: 220.127.116.11-18.104.22.168 30/ 255.255.255.252
Anyone please correct if I'm wrong.
Eng.Rasha on June 20, 2012:
If I have a network address 22.214.171.124/24 , and I have 5 Groups i wanna to find the subnetmask , ip address, and the range of ip address for each one, the groups are :
S1: 95 users
S2: 50 users
S3: 28 users
S4: 9 users
and S5: 2 users, plz i need to know the answer.
with my great thank.
kiruthi on June 16, 2012:
veryyyyyyyyyyyyyyy gooooooooooood subnet explanation..thanku so much
Deep on May 23, 2012:
thanks for the informative material which made a lot many concepts clear to me.
Fi Whitchelo from Glasgow, United Kingdom on May 09, 2012:
There are no words to describe how much this has helped :-)
email@example.com on May 06, 2012:
The Answer shown by the calculator is correct.
For 126.96.36.199/29 we leave last three bits in the fourth octet for host portion.
Hence the incremental value will be 8. (Hope everbody knw how to calculate the incremental value)
new subnet mask for /29 will be 255.255.255.248
so last subnet in this network is 188.8.131.52
last but one subnet is
184.108.40.206 which is a network ip
220.127.116.11-18.104.22.168 is valid host ip
22.214.171.124, the given ip is the broadcast ip of that netwok.
Please reply to my mail if there is any mistake in this calculation.
by paranthaman, firstname.lastname@example.org
Mustafa on April 07, 2012:
can you help me plz...
my exam Q?
if a company has address is "126.96.36.199"
and the company has 20 sections each has subnetwork.
1)what is mask address in dotted decimal and slash notations?
tarun on March 14, 2012:
Can anyone find the network id of 188.8.131.52/29 ip address. I've got network id 184.108.40.206 but in calculator id is 220.127.116.11.
plz elaborate the solution how it comes.
32-29 = 3
So we jump in 2***.5 or .32
239/32 = 7
7 * 32 = 224
Network = 18.104.22.168 to 22.214.171.124
abhi on February 29, 2012:
is dere any other easy way to understand?
s adas d on February 10, 2012:
sad asdasd as das das
yeah!!! on February 10, 2012:
Akhilesh on February 07, 2012:
yes, it is really very informative
Manoj Prabakar on January 25, 2012:
Azfar Ahmad on December 15, 2011:
It's very nice. A simple steps has been given by u for students who don't know how to do subnetting. Thanks a lot............................!!!
nirajan parajuli on February 28, 2011:
like very good it s information .
Debasish on February 25, 2011:
CIA on January 23, 2011:
Simple, clear, precise and direct to the point! Can't ask for more, its really informative! Thanks alot!
Arjohn Garcia Poquiz on December 16, 2010:
Very good site...! very interesting...! the easy way...!
achhar on September 02, 2010:
i wanna know more on yhis
Ruwan on June 04, 2010:
Thank you very much,Got the idea very clearly
Avinash on November 12, 2009:
Nice one man..very nice tut!
Boriboon Deeka on July 02, 2009:
Very Best, I need Part III
bskvsdm from Bangalore on November 11, 2008:
i found this article as great....it is very simple and clear.....Even a layman can
understand easily......good article...
Murali on November 05, 2008:
I always had few doubts regarding subnetting.After reading this article I have found the answer to all my doubts. It's a nice article
Subodh Gupta on November 04, 2008:
yes, it is really very informative and cleared my few doubts as well.
Yogesh R on November 04, 2008:
Thanks for sharing subnetting...really very helpful and informative.