Hands down one of the most important things to know in the networking world is how to subnet. If you are going to work on anything past your basic Linksys home router than you better have a good understanding of how it works. If you are considering taking any Cisco certifications than it’s a MUST. There is absolutely no way to even finish all of the questions on the CCNA if you can’t do subnet calculations in well under a minute. While studying for my CCNA I became especially frustrated with subnetting. The way the Cisco Press books taught you to do it took far too long and required writing a lot of stuff down. A colleague of mine showed me a different way to do it and with enough practice you can do all the calculations in your head. I’ll outline the method below since I haven’t found another online resource that does so.
Step 1 – Memorize the subnet mask values
Subnets are 8 bits long and are inverse. That is they start “filling” from left to right rather than right to left.
1 – 128
2 – 192
3 – 224
4 – 240
5 – 248
6 – 252
7 – 254
9 – 255
As a side note subnet masks can be represented in a few different ways…
Dotted Decimal Notation – 255.255.192
Prefix Notation – /18
Binary – 11111111.11111111.11000000.00000000
Step 2 – Find and locate the Interesting Octets
The interesting octet is found by locating the “weird” subnet mask octet. If the octet isn’t composed completely of 1’s or 0’s its weird. And weird is interesting : ) For instance in the subnet mask 11111111.11111111.11000000.00000000 octet 3 is interesting since its not totally 1’s or 0’s. The IP address’s interesting octet is the same as the subnet masks.
Step 3 – Find the special number
The “special” number is found by subtracting the value of the subnet masks interesting octet from 256. For instance with a subnet mask of /18 the interesting octet’s value would be 192 since the octet has 2 bits that are 1. You then subtract 192 from 256 leaving you with 64. So the special number is 64.
Step 4 – Find the network number
To find the network number you keep adding the special number to itself getting as close to the IP Addresses interesting octet number without exceeding it. So if you had the IP address and subnet of 216.21.245.17 /29 our special number would be 8. So we add 8 to itself until we get close but don’t exceed 17. 17 is the IP addresses interesting octet. We know this because the subnet mask’s interesting octet is the 4th octet since it isn’t all 1’s of 0’s.
0 + 8 = 8
8 + 8 = 16
16 + 8 = 24
The closest we can get to 17 without going over is 16. Now all we do is put that in the place of the IP addresses interesting octet. Our Network number is 216.21.245.16. We copy any octets prior to the interesting octet so we brought over 216.21.245 and then added our 16 in the interesting octet. If the interesting octet would have been the third or second octet we would have just put 0’s in any octets to the right of the interesting one. We’ll see that in the examples.
Step 5 – Find the rest of the subnet information
The rest is pretty easy. We add another iteration of the “special” number to our network number’s interesting octet. This calculates the next possible network number using that mask. So in our case the next network number is 216.21.245.24 since 16 (our calculated network number) plus 8 (our special number) gives us 24. If we subtract 1 from the 24, we get our networks broadcast address. The number proceeding the broadcast address is the last usable IP in the subnet. The first usable IP in the subnet is the network number plus 1. So here it all is…
Given IP address – 216.21.245.17 /29
Network number – 216.21.245.16 /29
First Usable IP – 216.21.245.17 /29
Last Usable IP – 216.21.245.22 /29
Broadcast IP – 216.21.245.23 /29
Now let’s walk through a few examples.
Example 1
Find the subnet info for the given IP address
IP address – 34.233.159.241 /12
Step 1 – Our subnet uses the first two octets. The first uses all 8 bits (255) and the second uses 4 bits (240)
Step 2 – The interesting octet is the second since its not all 1’s and 0’s
Step 3 – 256 – 240(the interesting octets dotted decimal value) = 16
Step 4 – Add up increments of 16 until we get close to 233 but don’t exceed it
0 + 16 = 16
16 + 16 = 32
32 + 16 = 48
……..
192 + 16 = 208
208 + 16 = 224
224 + 16 = 240
The winner is 224 since 240 exceeds the 233 value. Copy the first octet from the IP, insert our 224, and put 0’s for the remaining octets. So our Network number is 34.224.0.0
Step 5 – Our next subnet with this mask would be 34.240.0.0 So our broadcast would be the closest IP to the next subnet. I like to think of it as literally 34.240.0.0 minus 1. That gives us a broadcast of 34.239.255.255. And 1 less the broadcast is the last usable IP which is 34.239.255.254. The first usable IP would be the network number plus 1 which gives us 34.224.0.1.
Example 2
Find the subnet info for the given IP address
IP address – 187.11.111.138 /27
Step 1 – Our subnet uses all four octets. The first three use all 8 bits (255) and the fourth uses 3 bits (224)
Step 2 – The interesting octet is the fourth since its not all 1’s and 0’s
Step 3 – 256 – 224(the interesting octets dotted decimal value) = 32
Step 4 – Add up increments of 32 until we get close to 138 but don’t exceed it
0 + 32 = 32
32+ 32 = 64
64+ 32 = 96
96+ 32 = 128
128+ 32= 160
The winner is 128 since 160 exceeds the 138 value. Copy the first three octets from the IP and insert our 128 in the last octet. So our Network number is 187.11.111.128.
Step 5 – Our next subnet with this mask would be 187.11.111.160. So our broadcast would be the closest IP to the next subnet. That gives us a broadcast of 187.11.111.159. And 1 less the broadcast is the last usable IP which is 187.11.111.158. The first usable IP would be the network number plus 1 which gives us 187.11.111.129.
If you are looking for more practice I found this website which creates subnet problems for you.
http://faculty.valleycollege.net/rpowell/jscript/subnet2.htm
Tags: Subnetting

Love the examples and thank you for the site.
BTW I think you meant “8 – 255” 🙂
1 – 128
2 – 192
3 – 224
4 – 240
5 – 248
6 – 252
7 – 254
9 – 255Kind Regards,
Pete
Thanks for reading! Glad you liked it, I’ll try and get in there and fix that 9. Good catch 🙂

Hi, Thanks for this information, it is helping me study for the Network+. However, I am a little confused with the last example. Step 5 states that the first Usable IP would be the network number plus 1, which you state is 187.11.111.119. But, the Network number is 187.11.111.128., so I got 187.11.111.129/27 How is this…? Did I do something wrong?
Thanks for everything!

You are absolutely correct. This is a typo on my end. The first IP should be the .129 address. I’ll adjust the post on my end.
Thanks for catching it!

Thank you for sharing all that info with us.
I really appropriate what you are doing.
You blog is awesome!!!!


5 comments
Comments feed for this article
Trackback link: http://www.dasblinkenlichten.com/subnettinghowto/trackback/