How to Subnet a Network
A properly designed subnet can do wonders for the security and performance of a network. The main idea in subnetting is to divide a network into smaller pieces, which we call subnets. Actually implementing a subnet is typically more difficult than simply using the default subnet mask of 255.255.255.0. This usually means that temporary or smaller networks do not need to be subnetted.
Security sees benefit since the IP addresses of the host computers on each subnet are masked by the network address- which means they are invisible to the outside world. We call this network address translation, or NAT. This same technique helps conserve IP addresses, since all hosts on the subnet essentially just use the network IP address during communication.
A Basic Review on Subnetting
If you’re a little rusty on the basics of subnetting, don’t worry. We’ll cover everything you need to know from beginning to end. First thing first: we need to learn about the IP basics.
The current version of internet protocol, or IP, is IP version 4. This IP version allows four octets of data to represent an IP address. Each octet is considered to be a byte, so there are 8 bits in every octet. Note that in binary form you can see that there are 8 numbers, each one consisting of a bit. Finally, each octet is separated by a period, as shown below.

Each IP address is usually represented in decimal form, as seen above as “192.168.2.1”. However, each IP address is actually used by computers in binary form. You may have noticed a huge flaw in IP version 4: the amount of unique IP addresses is limited! To be exact, only 4,294,967,296 unique IP addresses can be created. This may seem like a large number but keep in mind every single device in the world needs a unique IP address to communicate with one another while online.
The IP version 6 protocol was created for when the transition is needed. Most computers don’t use IPv6 just yet, but in the future it will inevitably be used. (In case you were wondering, IPv6 will support 2^128 unique IP addresses… egad!)
Classes
There are three main types of classifications of IP addresses in IPv4: class A, class B, and class C. There are class D and class E types, but those are for multicasting and private uses, respectively. Each class differs by the number of network and host octets it has. Each network octet is for classifying which network a host is on. More network octets will mean more networks! Likewise, each host octet specifies a host that can be assigned to the network. More host octets means more computers per network.
Each class has a certain range that the first octet can be assigned to. This lets us know to what network class any IP belongs to with ease. Review the diagram below to see a visual diagram.

Now the bad news: you must memorize each range for each class if you hope to pass most network exams. Don’t worry! It’s actually easy- just memorize how we get the numbers, not the numbers themselves! All you have to do is remember n^8 (read as “n” to the eighth power), and how many network portions each class has. Review the diagram below.

One final note before we move on. Notice how we didn’t use the IP address 127 for the class A network- that’s because this is loopback address. We use this for testing configurations on the IP network. Also take note that there are reserved IP addresses, such as those for private networks. These IP addresses will not connect to the internet, which is handy if you just want computers to be connected with each other- and not the whole world.
Subnet Masks
A subnet mask is what we use to assign different amounts of networks and hosts to an IP network. It essentially divides the IP address into two parts: the network and host. This is a trading game- the more hosts you have, the fewer networks you will have. And yet the more networks you have, the fewer hosts you will have. Review the class A default subnet masks as shown below.

The class B network will need to recognize two network portions, and two host portions. This can be seen in the below diagram.

Lastly, we have the class C subnet. It is the most commonly used subnet, so pay special attention to it in the upcoming lecture. You can see a diagram of the default subnet below.

We’ve laid Down the Foundation, Let’s Build the House!
We just reviewed the basics of IP addresses and subnet masks. The bad news is, we usually don’t use the default subnet mask at all when we subnet a network! The good news is, learning how to subnet isn’t too hard. It will, however, take some practice.
An Example of Subnetting a Class C Network
Subnetting varies in difficulty, depending on which class you are subnetting. More often than not, you will need to create a subnet for a class C network. A class C network allows for many networks to be created, but not as many hosts. In fact, you can create a hefty 2,097,152 networks- but only 254 hosts per network are allowed.
Let’s say we are subnetting a school’s network. We need 5 separate networks that have 30 computers on each subnet.
First we calculate how many usable subnets we need. Next we will need to determine how many hosts are required. Both of these values can be calculated with the following equations:
Two Important Equations to Remember:
- 1. Usable Subnets = (2^n) – 2 , where N = power of bits assigned
- 2. Usable Hosts = (2^n) – 2 , where N = power of bits remaining
Let’s start with usable subnets. Review the diagram below for a visual example.

If you are wondering what the “-2” part of the equation is for, this is how we account for the two addresses in each subnet we can’t use. We will review what these addresses are for more specifically later on. For now, let’s find out what our usable hosts are!

Alright Already! What’s My Subnet Mask?!
Getting your subnet mask at this point is incredibly easy. Simply take all of your network bits, and add them up. Look at the diagram below for a visual guide.

That’s it! You’re done. You have successfully created a subnet mask that can be used on the school’s network. Keep in mind that every computer must have the subnet mask set in order for them to be on the same network. Also note that since we are using a class C network, the first three octets will always be 255. When subnetting other classes, be sure to keep the network portions in mind.
Closing Comments
Subnetting may not be fun, but it is required for students to know on networking exams. That means you should stay away from subnet calculators until you have grasped the full concept of how to do it yourself. These calculators should only be used as a time saving tool, not a learning tool or way to cheat on homework.
With enough practice, subnetting will become much easier. Class A and Class B networks are a bit trickier, but follow the same example as shown above and it should be quite easy to accomplish.



Pingback by Kopi-Oh Times » Blog Archive » How-to: Subnet a network on 9 March 2008:
[...] NAT and so on. Check this web site out for a very visual way of illustrating what subnet is about: http://learn-networking.com/network-design/how-to-subnet-a-network Share and Enjoy: These icons link to social bookmarking sites where readers can share and [...]
Comment by william on 11 March 2008:
i think this article was a great. easy to follow
Comment by guillermo galdames on 21 March 2008:
I have to say….thanks….this article is much more clear and efficient…now I have learn how to make a subnet…!!!yeap!
Comment by GEORGE on 25 May 2008:
I have searched the net and I should say I have not come across an article like this which is so easy to understand and learn the concepts.
cheers
Comment by Hussam on 5 June 2008:
thanks for the lovely article and I want to add that
the amount of IPv6 is 34,028,236,692,093,846,346,337,460,743,177 Unique Ip Address
Comment by padma on 13 June 2008:
This is a very well written article.Easy to follow.I am happy that I came across this.Thank you.
Comment by Yousaf on 14 June 2008:
Now this is a true, efficient, user-friendly, easy and simple way to teach subnetting. I search the whole internet almost but this tutorial is awsome. I appreciate you of publishing these tutorials here. Thanks a ton !!
Comment by eddy on 10 July 2008:
HI,
very nice work,
u really have a smooth way to deliver information, thanks for the clear efforts ur making.
allow me to mention a small note here regarding the use of (N) and (n) , i think replacing N with 2 in the tables would be less confusing while using (N and M) or N and (32-N) in the equation will make it more rational..
all my respect.
and thanks again.
Comment by Dana on 28 August 2008:
This tutorial should be put in a place of honor. The best!!!
Comment by Chris on 3 September 2008:
Thank you, I now have a better understanding of subnet masks.
Chris.
Comment by sophie on 5 September 2008:
Thanx very much!
For sure its a long time since i was looking for this but today you change ma brain.
I really like the way you deliver information/skills, it seems to me very tough to study it in my class n get the concept of subnetting. But today am sure i may even taught someone n get the real meaning of subnetting.
If u don mind can u please give us some more example by using other classes A & B? Am sure you can
Once again thank you very much!! God bless you
Comment by Devendra on 20 September 2008:
The artical gives good information in systematic manner.It will be bit easier to understand with digramatic representation
Comment by Tasnim hafiz on 28 September 2008:
I am totally confused with my first networking course. Unfortunately my exams tomoro, n I foudn this website today…:p if I pass the exam..I will join this community for future:D
Comment by Satheeshiyer on 28 September 2008:
Hey.. Thank you for sharing this superb article.. I have come across many sites.. but couldn’t get the idea of subnetting..
But finally when I came across this, my cheek started to smile a bit.. from nervousness..
Superb Article ………….
Smiling ever!!
Comment by stanlywit on 30 September 2008:
its interesting to see this article ……….how it produces better knowledge who are all in doubt regarding the concept subnetting
Comment by Jelkyes on 4 October 2008:
I can’t believe that people can actually sit to make things easier for their fellow humans like this free. The material is the best I have ever seen on subnet. Continue with the good work.
Comment by nasir sohail on 20 October 2008:
i am cheerful to find this information because it greatly hepled me to understand the lecture i took from my ccna class yesterday , i am really thankful for this infromation
Comment by MCQ on 22 October 2008:
This is really hard worked, labored, very useful article.
Thanks a lot to the administrator. I liked the article and included the link of this article on my site http://www.psexam.com/websites/others/2.html
Comment by Tom on 22 October 2008:
IPv6 blows my mind… Here’s some back-of-the-envelope calculations I’ve made about it:
-If every person had a trillion devices, each with their own unique IP address, and there were a trillion people on the planet, and there were a trillion such worlds, we would still be using only a fraction of the possible IP addresses.
-There are enough IP address to assign every single atom in over 6 trillion kilograms of carbon a unique address.
-Hussam’s number isn’t right. The actual number of unique IP addresses is (taking the 2^128 number to be correct):
340,282,366,920,938,463,463,374,607,431,768,211,456
Note that MS Calculator can’t display the number of digits necessary for this, and Hussam wrote what it showed.
Comment by Gary on 4 November 2008:
Well organized and useful! I wish to point out a pair of unnecessary ambiguities that could be removed to make the presentation even clearer:
“Powers of N” are really powers of 2. Perhaps N is used here for historical reasons? If not, I would replace it with 2.
If keeping “Powers of N” please do not re-use N as a generic variable, such as in the formula 2^n – 2. Any other letter (e.g. x) would work here.
Thanks
Comment by Baron Von Cisco on 7 November 2008:
Thoroughly good article, clean cut and precise. However, comments like “Subnetting may not be fun, but it is required for students to know on networking exams. That means you should stay away from subnet calculators until you have grasped the full concept of how to do it yourself.”
Although I completely understand the need for students to understand how to subnet, it is fickle to say the above. What benefit is it to not use a calculator. If your stuck in the situation where you need to create subnets then the quickest and easiest solution is to use the calculator. Its good to know manually how to do it but when was the last time you sat a maths exam without a calculator ?
Comment by PaRaNa on 24 November 2008:
Great article ,Thanks for this. But you have shown class C IP blog only on the your examples. Anyway, all of them easy already.
Comment by chris on 4 December 2008:
im pretty sure that you can contary to as you mention use all ones or zeros for the subnet portion in a network so there is no need to subtract two when calculating. you can’t use all ones in the host portion though. cant tell you the rfc. well written. great way of plotting it out.
Comment by shadab on 3 February 2009:
Explanation is too good… easy to understand. Thanks keep up the good work.
Comment by Roxane on 6 March 2009:
You know, I am speechless. I searched allll over the web for the right explaination. Man you did a great job. It went straight to the point. Now I can do this with confidence. Thank you very much.
Comment by saul on 9 March 2009:
i totally found this enlightening. thanx. God bless
Comment by melvit on 12 March 2009:
hi i liked the contents of this article.they are very satisfactory.!!!!!!!!!!
Comment by Rudy on 30 April 2009:
Love it
This subnetting explanation was package in the most simple way yet so easy to understand. I wish I could get more info like this..
Thanks for the good work.
Comment by zild on 8 May 2009:
Hi, Thanks for the tutorial
Comment by Safinatu on 11 May 2009:
Hi, thanks for the tutorial, it really helped me.
Comment by 1di0T on 15 May 2009:
Sorry for being a dumb…
I am confuse on the example problem:
Number of Subnets Needed: 5
What power of 2 allows five networks?
——————————————-
Power of N: N7 N6 N5 N4 N3 N2 N1 N0
——————————————-
>>>>Equals: 128 64 32 16 8 4 2 1
——————————————-
Since 1 + 2 + 4 = 7, we can use N3 (This is where I got confused)???
You said we can use N3 but the one you’ve encircled is N2 = 4
and 1 + 2 + 4 is on N2 N1 and N0 and not N3.
Usable Subnets = 2^3 – 2 (On this part it appears you’ve used N3)
Usable Subnets = 8-2 = 6
I know that 8 > 5, the reason why you used 1+2+4
What power of 2 allows five networks? -> In between 8 – 4
Crap I’ve answered my question…
I think this is still worth posting for future confused like me to be enlightened.. Lol
Comment by Karl on 18 May 2009:
Very good!!! This is the best tutorial I have read on the internet.
Subnetting… DONE!!!
Comment by jm on 22 May 2009:
I have the same problem!
Comment by janak on 29 May 2009:
i am also little confused,
Since usable Subnets = 2^3 – 2, what if i want 7 subnets?
thank you
Comment by Brian on 4 June 2009:
Are IP adresses different from subnet masks? So would a device have an IP address ‘192…’ and ALSO a subnet ‘255…’?