Welcome

First of all, may I welcome you to my site. My name is Chris and I'm from the UK and work as a Systems Engineer for Cisco. This blog was initially created to post up my subnetting technique but has now got more stuff to do with attaining Cisco certifications. Either way I really hope that the content is sufficent for your needs and I look forward to hearing your feedback. If you find that the content really helps you please feel free to donate using the PayPal link on the right.

We need to start with the fundamentals of IP addressing. An IP address is made up of 32 bits, split into 4 octets (oct = 8, yes?). Some bits are reserved for identifying the network and the other bits are left to identify the host.

There are 3 main classes of IP address that we are concerned with.

Class A

Range 0 - 127 in the first octet (0 and 127 are reserved)

Class B

Range 128 - 191 in the first octet

Class C

Range 192 - 223 in the first octet

Below shows you how, for each class, the address is split in terms of network (N) and host (H) portions.

NNNNNNNN

.

HHHHHHHH

.

HHHHHHHH

.

HHHHHHHH

Class A Address

NNNNNNNN

.

NNNNNNNN

.

HHHHHHHH

.

HHHHHHHH

Class B Address

NNNNNNNN

.

NNNNNNNN

.

NNNNNNNN

.

HHHHHHHH

Class C Address

At each dot I like to think that there is a boundary, therefore there are boundaries after bits 8, 16, 24, and 32. This is an important concept to remember.

We will now look at typical questions that you may see on subnetting. More often than not they ask what a host range is for a specific address or which subnet a certain address is located on. I shall run through examples of each, for each class of IP address.

What subnet does 192.168.12.78/29 belong to?

You may wonder where to begin. Well to start with let's find the next boundary of this address.

Our mask is a /29. The next boundary is 32. So 32 - 29 = 3. Now 23 = 8 which gives us our block size.

We have borrowed from the last octet as the 29th bit is in the last octet. We start from zero and count up in our block size. Therefore it follows that the subnets are:-

We have borrowed from the second octet as bit 12 sits in the second octet so we count up the block size in that octet. The subnets are:-

10.0.0.010.16.0.010.32.0.010.48.0.0.............etc

Our address is 10.34.67.234 which must sit on the 10.32.0.0 subnet.

Hopefully the penny is starting to drop and you are slapping the side of your head realising that you were a fool to think it was hard. We will now change the type of question so that we have to give a particular host range of a subnet.

What is the valid host range of of the 4th subnet of 192.168.10.0/28?

Easy as pie! The block size is 16 since 32 - 28 = 4 and 24 = 16. We need to count up in the block size in the last octet as bit 28 is in the last octet.

Therefore the 4th subnet is 192.168.10.48 and the host range must be 192.168.10.49 to 192.168.10.62, remembering that the subnet and broadcast address cannot be used.

What is the valid host range of the 1st subnet of 172.16.0.0/17?

/17 tells us that the block size is 224-17 = 27 = 128. We are borrowing in the 3rd octet as bit 17 is in the 3rd octet. Our subnets are:-

172.16.0.0172.16.128.0

The first subnet is 172.16.0.0 and the valid host range is 172.16.0.1 to 172.16.127.254. You must remember not to include the subnet address (172.16.0.0) and the broadcast address (172.16.127.255).

What is the valid host range of the 7th subnet of address 10.0.0.0/14?

The block size is 4, from 16 - 14 = 2 then 22 = 4. We are borrowing in the second octet so count in the block size from 0 seven times to get the seventh subnet.

The seventh subnet is 10.24.0.0. Our valid host range must be 10.24.0.1 to 10.27.255.254 again remebering not to include our subnet (10.24.0.0) and the broadcast address (10.27.255.255).

What if they give me the subnet mask in dotted decimal?

If you're lucky and they give you a mask in dotted decimal format then you should have an even easier time. All you need again is your block size.

Let's say they have given a mask of 255.255.255.248 and you wish to know the block size. Here's the technique:

1. Starting from the left of the mask find which is the first octet to NOT have 255 in it.

2. Subtract the number in that octet from 256 to get your block size (e.g. above it is 256 - 248 = block size of 8).

3. Count up from zero in your block size in the octet identified in step 1 as you have learned above (the example above would be in the last octet).

Another example is a mask of 255.255.192.0 - you would simply count up in 256 - 192 = 64 in the third octet.

One more example is 255.224.0.0 - block size is 256 - 224 = 32 in the second octet.

What other questions may they ask?

You may find they ask for how many bits you need to borrow for a certain amount of subnets, the subnet mask needed for a certain number of hosts, or the number of hosts per subnet. THESE ARE ALL EASY TO CALCULATE! All you need to remember is that you borrow bits for subnets and reserve bits for hosts.

There are two simple formulas:

Number of subnets = 2n where n is the number of bits borrowed

Number of hosts = 2(32 - n) - 2 where n is the number of bits in your subnet mask

Let's think of some questions. How many bits do you need to borrow to accommodate 6 subnets? No matter what address you are given the maths is still the same. The formula is 6 = 2n so you must find n which in this case is 3 as n = 2 gives only 4 subnets and n = 3 gives 8 subnets. Simply add n to your mask for your new subnet mask. For example, if you had a /24 address and you wanted 8 subnets then your mask will be 24 + 3 = /27.

What subnet mask should you use if you wanted 60 hosts per subnet? The formula is 60 = 2(32 - n) - 2 so you must find n which is 26. This is easy to find as you know that 26 - 2 = 62 so simply subtract 6 from 32 to get the 26. Therefore your mask is /26.

Lastly the number of hosts per subnet. How many hosts per subnet in the address 172.16.0.0/23? You have a /23 address therefore you formula is x = 2(32 - 23) - 2 = 29 - 2 = 510.

Another typical question they may ask will be giving you an IP address and mask and asking how many subnets and hosts there are from that address, for example:

Question: How many subnets and hosts per subnet can you get from the network 172.30.0.0/28?

From this you only need two pieces of information:

1. The default subnet mask of the address class.2. The subnet mask in the question

Using the example above we know that:

1. The default subnet mask is /16 as the address given is a class B address2. The subnet mask in the question is /28

78
comments:

hello, i have just one question. why is it that on example What is the valid host range of the 7th subnet of address 10.0.0.0/14?

The Answer was : Our valid host range must be 10.24.0.1 to 10.27.255.254 again remebering not to include our subnet (10.24.0.0) and the broadcast address (10.27.255.255).

Ca you show to us the complete solution? is it correct that it should have? :

10.0.0.010.4.0.010.8.0.010.16.0.010.32.0.010.64.0.010.128.0.0

and the seventh subnet would be 10.128.0.0 not 10.24.0.0?

help pls. thanks!

Chris' Reply:

Hi Gino,

As it is a /14 address and the next boundary is a /16 our block size is 2^(16-14) = 2^2 = 4 (where ^ is "to the power of"). We are borrowing in the second octet so all we have to do is count up in 4's within that octet like so:

Now the reason i am posting this comment or rather question is because i have a question which nobody has an answer for.I am preparing for CCNA and somebody asked me this question.Any help will be appreciated.

Question: What is the Binary ID of loopback's Network?

Answer: a)0 b)1 c)10101010 d)11111111

Now here is what i interpret from this question.I have to find the binary representation of network for the address 127.0.0.1 .

I am not sure if this question is correct but i am not sure what to do with this.

The loopback address is 127.0.0.1 which is a Class A address. The network portion of a Class A address is the first octet, in this case 127. The binary representation of 127 is 01111111. You may find text omitting the leading 0 so you may just have seven 1's.

Check out http://www.thecertificationhub.com/networkplus/networkplus_test_bank.htm as your question is also answered there.

Thanks so much for this article! I'm not yet studying for my CCNA but rather my XP (70-270) and was having a heck of a time trying to understand subnets. Thanks for taking the time and trying to teach others what you've learned!!

I am getting different answers on this question. The number of valid subnets for 200.1.1.0/26 If I use the next boundary 32 in the /26 question I get 64 but the answer is 4 because of the Class C address of /24. I am confused, please help?

BUDDY said "Hello Chris,I am getting different answers on this question. The number of valid subnets for 200.1.1.0/26If I use the next boundary 32 in the /26 question I get 64 but the answer is 4 because of the Class C address of /24. I am confused, please help?"

64 is number of IP adress per subnet.so 256/64 = 4 that's number of subnets

I would say that as it is a Class C network your default mask is /24. You have a /26 so you therefore have 2 ^ (26 - 24) subnets = 4. Your block size is 2 ^ (32 - 26) = 2 ^ 6 = 64. Your subnets are therefore at 0, 64, 128, and 192 in the last octet as you have correctly put.

Hi Chris,I had such a confusion on subnetting that i couldnt follow, even after reading tons of books. Your method of subnetting is the best and have learnt in just a day. Thanks a lot.Keep up the good work.

192.168.12.78/8 - a /8 is a Class A boundary so you would expect an address between 1.x.x.x and 126.x.x.x, for example, 10.1.1.1/8 is network 10.0.0.0 with valid host range of 10.0.0.1 through to 10.255.255.254 There are no subnets!

192.168.12.78/16 - a /16 is a Class B boundary so you would expect an address between 128.x.x.x and 191.x.x.x, for example 172.16.1.1/16 is network 172.16.0.0 with valid hostrange of 172.16.0.1 through to 172.16.255.254. There are no subnets!

192.168.12.78/24 - a /24 is a Class C boundary so you would expect an address between 192.x.x.x and 223.x.x.x. In your example the network is 192.168.12.0 with a valid host range of 192.168.12.1 through to 192.168.12.254. There are no subnets!

192.168.12.78/32 - a /32 is a special case where the subnet and host is the same, that is, in your example, 192.168.12.78 is both the subnet and the valid host range.

hi chris, your blog and the above article on subnetting are very useful for me. i never felt subnetting that easy until i read ur article.im expecting more articles like this from you.if possible please do post articles on subnet zero and vlsm. last but not least Thank you so much for all the articles in your blog.....

That said I am having a few issues with questions where it asks for how many subnets and hosts for a given network. For example:

Question: How many subnets and hosts per subnet can you get from the network 172.30.0.0/28?

Answer: 4096 subnets and 14 hosts

Now I can get the 14 hosts bit but from reading your blog I'm thinking that the /28 means that we're only looking at the 4th octet so I'm thinking that as our range is 16 there must be 16 available subnets (16 x 16 = 256) but clearly I'm wrong.

I'm sure it has to do with the network being class B but where do I go from there?

That said I am having a few issues with questions where it asks for how many subnets and hosts for a given network. For example:

Question: How many subnets and hosts per subnet can you get from the network 172.30.0.0/28?

Answer: 4096 subnets and 14 hosts

Now I can get the 14 hosts bit but from reading your blog I'm thinking that the /28 means that we're only looking at the 4th octet so I'm thinking that as our range is 16 there must be 16 available subnets (16 x 16 = 256) but clearly I'm wrong.

I'm sure it has to do with the network being class B but where do I go from there?

Hi,

These sorts of questions are very simple. If I haven't covered these sorts of questions perhaps I should add that in here somehwere.

172.30.0.0/28

What can we tell from that address? The two very basic things we know is that it is a Class B address and that it has a /28 mask.

Hi Chris,Thanks a ton for your time publishing this to us free.God bless you my friend. I got following problem, please help me.---------------------------------Question: Which subnet does host 172.31.56.247 255.255.255.240 belong to? Answer: 172.31.56.240------------------------------172.31.56.247255.255.255.240

Thanks again for your quick update regarding my question and your answer was really awesome. I spend too much money on Cisco Academy, but could not figure it out, how do subletting. All the i was so confused. I know i was also stupid didn't try that hard, some people even from cisco academy in my place did well, few of them was like me got lost on the way. I do believe many people stack on it, BUT ALL YOUR EFFORT, ONLY YOURS THAT MADE MY SELF CONFIDENT, whatever my position its only after reading your blog, thanks google, thank Chris.

-------------------------------- What is the broadcast address of the network 172.28.229.0 255.255.255.0?

Answer: 172.28.229.255--------------------I am not sure where to start here, how to find out the block size, sorry to disturb you again, hope you don't mind

Your question involves subnetting directly on a boundary. In your case you have a Class B address subnetted to the default mask of a Class C address (i.e. /24). In this case the Class B address behaves just as it would a Class C address with a default mask.

For example, let's take a Class C address with default mask:

192.168.1.0/24

You automatically know that the broadcast address is 192.168.1.255 as you have the whole of the final octet.

Take a Class B address of:

172.28.229.0/24

There is no difference except for the numbers of course. You still have the whole of the last octet to play with so the broadcast address must be 172.28.229.255

I hope you understand this. If not I'm more than happy to assist you further.

First off, thank you so much for this. It is a huge help in studying for my CCNA, as subnetting has been my biggest issue. I'm still a little weird on the types of questions like the following:

You have a network ID of 140.140.0.0 and need to break it down into a number of subnets. You need 600 host IDs per subnet, with the largest number of subnets available. Which of the following subnet masks should you use?

a)255.255.240.0b)255.255.252.0c)255.255.224.0d)255.255.248.0

How best do I answer this? Instead of figuring out the numbers for each of the listed subnet masks?

The block size in this question is 4 as your next boundary is 16 while your subnet mask is /14. If we subtract 14 from 16 we get 2. We then say 2 to the power of the 2 we just worked out which gives us 4.

As our mask is /14 we then can say that the 14th bit is in the second octet. We therefore count up in our block size in the 2nd octet.

Our first subnet is therefore:

10.0.0.0/14

And the 2nd subnet is:

10.4.0.0/14

3rd is:

10.8.0.0/14

etc

Until we come to the 7th octet which is 10.24.0.0/14

Our 8th octet is 10.28.0.0/14 so the broadcast address for the 7th subnet is one less than the 8th subnet so this must be 10.27.255.255

Ive couple of questions which i couldn't understand ,am pasting the related paragraphs:

Let's think of some questions. How many bits do you need to borrow to accommodate 6 subnets? No matter what address you are given the maths is still the same. The formula is 6 = 2n so you must find n which in this case is 3 as n = 2 gives only 4 subnets and n = 3 gives 8 subnets. Simply add n to your mask for your new subnet mask. For example, if you had a /24 address and you wanted 8 subnets then your mask will be 24 + 3 = /27.

What subnet mask should you use if you wanted 60 hosts per subnet? The formula is 60 = 2(32 - n) - 2 so you must find n which is 26. This is easy to find as you know that 26 - 2 = 62 so simply subtract 6 from 32 to get the 26. Therefore your mask is /26.

1: in the 1st paragraph how can we calculate the value of n , please elaborate it for me.

2: In the 2nd paragraph how did you got the value of n =26??

please help me get over with it and the rest of things u described here are outstanding,

now in the second octet11111100 here like in binary each octet the power of128.64.32.16.8.4.2.11 .1 .1 .1 .1.1.0.0--------------.*.0.0here last one form left as star power of binary 4 it mean block of 4 will bethen 10.0.0.0(first NID)10.4.0.010.8.0.010.12.0.010.16.0.0......10.252.0.0..10.255.255.25410.255.255.255 (last finally BID)

and number of subnet and number of host per subnetsubnet=2^n here n is totel network bit borrowhost per subnet=(2^m)-2here mis total left bit (Host)in that subnet=2^6=64 subnethost per subnet=(2^18)-2 =262144-2=262142thanks

now in the second octet11111100 here like in binary each octet the power of128.64.32.16.8.4.2.11 .1 .1 .1 .1.1.0.0--------------.*.0.0here last one form left as star power of binary 4 it mean block of 4 will bethen 10.0.0.0(first NID)10.4.0.010.8.0.010.12.0.010.16.0.0......10.252.0.0..10.255.255.25410.255.255.255 (last finally BID)

and number of subnet and number of host per subnetsubnet=2^n here n is totel network bit borrowhost per subnet=(2^m)-2here mis total left bit (Host)in that subnet=2^6=64 subnethost per subnet=(2^18)-2 =262144-2=262142

This is the best tutorial on Subnet i have ever read. Thank you so much Chris! You made it so easy to understand...all of the other post and even cisco books have made it overly complicated and way too confusing!

suppose you have given a class B ip address 172.12.12.1. with default sub-net mask 255.255.0.0 and asked to create 3 networks and each network should have 3 hosts, then what will be the subnet mask,what are the different sub networks, what is the host range in each network

what to do if the no of subnets is greater than 32.i have a question An organization is granted the block 130.56.0.0 in class B. The administrator wants to create 1024 subnets.a. Find the subnet mask.b. Find the number of addresses in each subnet.

So for both of your questions you have a subnet mask of 255.255.254.0 which is equivalent to a /23. That means your block size is 2 to the power of (24 - 23) which equals 2 subnets. The number of hosts is therefore (2 to the power of (32 - 23)) - 2 = 510 hosts.

wow after three classes on this i had become COMPLETELY overwhelmed by all the different techniques that we were being shown for subnetting but this is by far the best way of doing things (for me at least)

wow after three classes on this i had become COMPLETELY overwhelmed by all the different techniques that we were being shown for subnetting but this is by far the best way of doing things (for me at least)

Hi Chris,Thanks for the wonderful explanation. I now understand everything you mentioned except the following part:

What subnet mask should you use if you wanted 60 hosts per subnet? The formula is 60 = 2(32 - n) - 2 so you must find n which is 26. This is easy to find as you know that 26 - 2 = 62 so simply subtract 6 from 32 to get the 26. Therefore your mask is /26.

Is there another way to explain this, especially finding the value of n, I simply just dont get it.

HiChris, almost after 10 year in this field i gave up on learning subnetting insted started using online calculators, nothing ever made sense to me man just reading your artical only once made me feel like every thing falls int place

HiChris, almost after 10 year in this field i gave up on learning subnetting insted started using online calculators, nothing ever made sense to me man just reading your artical only once made me feel like every thing falls int place

I was looking for help on understanding subnetting when I stumbled onto your site. This is much easier to grasp than any other method I have seen. I am sure I'll have some questions as I study this but your approach to explaining it is far more direct and to the point. Thanks for your commitment to helping those of us who are trying to learn. Aaron B.

I've already posted about route summarization but I found this interesting technique for calculating complex route summaries at http://w...

Customer Feedback

"Can I just say, I am absolutely in LOVE with you and this blog right now. I was going to actually buy some lame ass simulator software or buy a bunch of cisco equipment to prepare for my CCNA. I kept thinking to myself, if only there was a better way...

Thanks so much for not only the tip, but the detailed tutorial on how to setup and actually use GNS3. This is completely invaluable information."Brad, GNS3 Configuration Guide comments

"Hi, just tested it.It's very incredible, perfect.Good work, if you have some tips for CCNA please post.I use GNS3 and DynamipsGreaaaaaaaaaaaat"Fayda, GNS3 Configuration Guide comments"Chris,I just visited your blog and I want to congratulate you on your effort. Guys, I recommend this subnetting tutorial."Forum Admin, www.how2pass.com"I wanted to thank the original poster for this information....reading this finally made it click and solved the mystery of subnetting for me and was instrumental in passing the CCNA yesterday."via Cisco Forum

"I just passed the CCENT test. I wanted to thank you for this post. Using your technique I'm able to answer subnetting questions in 20 sec in my head. Great job."via Cisco Forum"I wanted to thank you for posting this. This has got to be the most concise and least brain cell damaging explanation I've come across to figure out the subnets when using prefix notation."via Cisco Forum

"Great, Keep it up! Your easy and quick method helped me a lot to pass CCNA. I took lot of time and did many mistakes, that's why I failed for the first time, but once I see this post, I thought I have found some magical tricks of subnetting."via Cisco Forum

"You deserve points for this post dude. Request all who were helped by this post to Rate the author for his splendid work."via Cisco Forum