Networking

Subnetting a Class B network address

Subnetting a Class B network can involve some serious thought! As a network administrator, you'll have to know it and know it well. Todd Lammle walks you through clear instructions and simple examples to help you learn this skill.

In my last Daily Drill Down, we went step-by-step through subnetting a Class C network address. Be sure you have read the previous two Daily Drill Downs, which discussed IP addressing and subnetting, before reading this Daily Drill Down.

In this Daily Drill Down, we will continue to subnet IP addresses, but we will use Class B network addresses. Class B network addresses provide us with more subnet and host bits to manipulate, which can be fun, not painful, when it is done correctly.

Class B subnets
In my last Daily Drill Down, we borrowed bits from the host portion of a Class C network address. Class C network addresses only have eight bits to manipulate into subnets. However, a Class B has 16 bits to play with. This will allow more subnets with more hosts per subnet than a Class C network ever could.

Table 1 lists all of the possible Class B subnets:

Table 1
Mask Binary Subnets Hosts per subnet
255.255.128.0 10000000.00000000 2 32,766
255.255.192.0 11000000.00000000 2 16,382
255.255.224.0 11100000.00000000 6 8,190
255.255.240.0 11110000.00000000 14 4,094
255.255.248.0 11111000.00000000 30 2,046
255.255.252.0 11111100.00000000 62 1,022
255.255.254.0 11111110.00000000 126 510
255.255.255.0 11111111.00000000 254 254
255.255.255.128 11111111.10000000 510 126
255.255.255.192 11111111.11000000 1022 62
255.255.255.224 11111111.11100000 2,046 30
255.255.255.240 11111111.11110000 4,094 14
255.255.255.248 11111111.11111000 8,190 6
255.255.255.252 11111111.11111100 16,382 2
All possible Class B subnets

There are quite a few more masks we can use with a Class B network address than we can with a Class C network address. Remember that this is not harder than subnetting with Class C, but it can get confusing if you don’t pay attention to where the subnet bits and host bits are in a mask. This takes practice!

In this Daily Drill Down, I will use the same techniques I used in the Class C article to subnet a network. We’ll start with the Class B subnet mask of 255.255.192.0 and figure out the subnets, broadcast address, and valid host range. We will answer the same five questions we answered for the Class C subnet masks:
  1. How many subnets does this mask provide?
  2. How many hosts per subnet does this mask provide?
  3. What are the valid subnets?
  4. What is the broadcast address for each subnet?
  5. What is the host range of each subnet?

Before we answer these questions, there is one difference you need to be aware of when subnetting a Class B network address. When subnetting in the third octet, you need to add the fourth octet. For example, on the 255.255.192.0 mask, the subnetting will be done in the third octet. To create a valid subnet, you must add the fourth octet of all 0s and all 1s for the network and broadcast address (0 for all 0s and 255 for all 1s).

Example 1: Answers for the 255.255.192.0 mask
  1. 2-2=2 subnets
  2. 2-2=16,382 hosts per subnet
  3. 256-192=64.0, 128.0
  4. Broadcast for the 64.0 subnet is 127.255. Broadcast for the 128.0 subnet is 191.255.
  5. The valid hosts are:

Subnet 64.0 128.0
first host 64.1 128.1
last host 127.254 191.254
broadcast 127.255 191.255

Notice that the numbers in the third octet are the same numbers we used in the fourth octet when subnetting the 192 mask. The only difference is that we add 0 and 255 in the fourth octet.

For the 64.0 subnet, all the hosts between 64.1 and 127.254 are in the 64 subnet. In the 128.0 subnet, the hosts are 128.1 through 191.254.

I know this is confusing, but I promise if you read this complete Daily Drill Down carefully, I can make it easier for you.

Work through a few more with me, and it should start to become clearer.

Example 2: 255.255.240.0
  1. 2-2=14 subnets
  2. 2-2=4094 hosts per subnet
  3. 256-240=16.0, 32.0, 48.0, 64.0, etc.
  4. Broadcast for the 16.0 subnet is 31.255. Broadcast for the 32.0 subnet is 47.255, etc.
  5. The valid hosts are:

Subnet 16.0 32.0 48.0 64.0
first host 16.1 32.1 48.1 64.1
last host 31.254 47.254 63.254 79.254
broadcast 31.255 47.255 63.255 79.255

Example 3: 255.255.248.0
  1. 2-2=30 subnets
  2. 2-2=2,046 hosts per subnet
  3. 256-248=8.0, 16.0, 24.0, 32.0, 40.0, 48.0, 56.0, 64.0, etc.
  4. Broadcast for the 8.0 subnet is 15.255. Broadcast for the 16.0 subnet is 23.255, etc.
  5. The valid hosts are:

Subnet 8.0 16.0 24.0 32.0 40.0 48.0 56.0 64.0
first host 8.1 16.1 24.1 32.1 40.1 48.1 56.1 64.1
last host 15.254 23.254 31.254 39.254 47.254 55.254 63.254 71.254
broadcast 15.255 23.255 31.255 39.255 47.255 55.255 63.255 71.255

Example 4: 255.255.252.0
  1. 2-2=62 subnets
  2. 2-2=1,022 hosts per subnet
  3. 256-252=4.0, 8.0, 12.0, 16.0, 20.0, 24.0, 28.0, 32.0, etc.
  4. Broadcast for the 4.0 subnet is 7.255. Broadcast for the 8.0 subnet is 11.255, etc.
  5. The valid hosts are:

Subnet 4.0 8.0 12.0 16.0 20.0 24.0 28.0 32.0
first host 4.1 8.1 12.1 16.1 20.1 24.1 28.1 32.1
last host 7.254 11.254 15.254 19.254 23.254 27.254 31.254 35.254
broadcast 7.255 11.255 15.255 19.255 23.255 27.255 31.255 35.255

Example 5: 255.255.255.0
  1. 2-2=254 subnets
  2. 2-2=254 hosts per subnet
  3. 256-255=1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, etc.
  4. Broadcast for the 1.0 subnet is 1.255. Broadcast for the 2.0 subnet is 2.255, etc.
  5. The valid hosts are:

Subnet 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
first host 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1
last host 1.254 21.254 3.254 4.254 5.254 6.254 7.254 8.254
broadcast 1.255 2.255 3.255 4.255 5.255 6.255 7.255 8.255

That last example was pretty simple. I hope you notice a pattern now. All the numbers were basically the same except we added the fourth octet into the address.

The more difficult process of subnetting a Class B network address is when you start using bits in the fourth octet for subnetting. For example, what happens when you use this mask with a Class B network address: 255.255.255.128? Is that valid? Absolutely! There are nine bits for subnetting and seven bits for hosts. That is 510 subnets, each with 126 hosts. However, it is the most difficult mask to figure out the valid hosts for.

Example 6: The Class B 255.255.255.128 subnet mask:
  1. 2-2=510 subnets
  2. 2-2=126 hosts per subnet
  3. For the third octet, the mask would be 256-255=1, 2, 3, 4, 5, 6, etc.
  4. For the fourth octet, the mask would be 256-128=128, which is one subnet if it is used. However, if you turn the subnet bit off, the value is 0. This means that for every subnet in the third octet, the fourth octet has two subnets: 0 and 128, for example 1.0 and 1.128.
  5. Broadcast for the 0.128 subnet is 128.255; the broadcast for the 1.0 subnet is 1.127. Broadcast for the 1.128 subnet is 1.255, etc.
  6. The valid hosts are:

Subnet 0.128 1.0 1.128 2.0 2.128 3.0 3.128 4.0
first host 0.129 1.1 1.129 2.1 2.129 3.1 3.129 4.1
last host 0.254 1.126 1.254 2.126 2.254 3.126 3.254 4.126
broadcast 0.255 1.127 1.255 2.127 2.255 3.127 3.255 4.127

The thing to remember is that for every subnet in the third octet, there are two in the fourth octet: 0 and 128. For the 0 subnet, the broadcast address is always 127. For the 128 subnet, the broadcast address is always 255.

Let’s continue with more subnetting into the fourth octet. This is exactly like subnetting a Class C network address, but the third octet is part of the subnet address.

Example 7: Class B network 255.255.255.192
  1. 2-2=1022 subnets
  2. 2-2=62 hosts per subnet
  3. 256-255=1.0, 2.0, 3.0, etc. for the third octet. 256-192=64, 128, 192 for the fourth octet. For every valid subnet in the third octet, we get four subnets in the fourth octet: 0, 64, 128, and 192.
  4. Broadcast for the 1.0 subnet is 1.63, since the next subnet is 1.64. Broadcast for the 1.64 subnet is 1.127, since the next subnet is 1.128. Broadcast for the 1.128 subnet is 1.191, since the next subnet is 1.192. Broadcast for the 1.192 subnet is 1.255.
  5. The valid hosts are as follows:

Subnet 0.64 0.128 0.192 1.0 1.64 1.128 1.192 2.0
first host 0.65 0.129 0.193 1.1 1.65 1.129 1.193 2.1
last host 0.126 0.190 0.254 1.62 1.126 1.190 1.254 2.62
broadcast 0.127 0.191 0.255 1.63 1.127 1.191 1.255 2.63

On this one, the 0 and 192 subnets are valid, since we are using the third octet as well. The subnet range is 0.64 through 255.128. 0.0 is not valid since no subnet bits are on. 255.192 is not valid because then all subnet bits would be on.

Example 8: Class B network 255.255.255.224
  1. 2-2=2046 subnets
  2. 2-2=30 hosts per subnet
  3. 256-255=1.0, 2.0, 3.0, etc. for the third octet. 256-224=32, 64, 96, 128, 160, 192 for the subnet value. (For every value in the third octet, we get eight subnets in the fourth octet: 0, 32, 64, 96, 128, 160, 192, 224.)
  4. Broadcast for the 1.0 subnet is 1.63, since the next subnet is 1.64. Broadcast for the 1.64 subnet is 1.127, since the next subnet is 1.128. Broadcast for the 1.128 subnet is 1.191, since the next subnet is 1.192. Broadcast for the 1.192 subnet is 1.255.
  5. The valid hosts are:

Subnet 0.32 0.64 0.96 0.128 0.160 0.192 0.224 1.0
first host 0.33 0.65 0.97 0.129 0.161 0.193 0.225 1.1
last host 0.62 0.94 0.126 0.158 0.190 0.222 0.254 1.30
broadcast 0.63 0.95 0.127 1.159 0.191 0.223 0.255 1.31

For this subnet mask, the 0 and 224 subnets are valid as long as not all subnet bits in the third octet are off or all subnet bits in the fourth octet are on.

When would we use this valuable information? All the time! For example, if you have a host configuration of 172.16.10.33 255.255.255.224, what subnet, broadcast address, and valid host range is this host a member of? (We would solve this question with the information presented above.)
256-224=32, 64

Bingo! In the fourth octet, the host address is 33. That is between 32 and 64, so the host is in the 32 subnet, which has a broadcast address of 63, and the valid host range is 33-62. Easy. Just remember that the subnet is 10.32 because the third octet is part of the subnet address.

Let’s try another one. You have a host configuration of 172.16.10.33 255.255.255.240. What subnet, broadcast address, and valid host range is this host a member of?

Since we did not go through this mask in this Daily Drill Down, you’ll have to figure it out on your own. It is done the same way as all the others.
256-240=16, 32, 48

Bingo! The host is in the 10.32 subnet, which has a broadcast address of 10.47 and a valid host range of 10.33 through 10.46.

Let’s keep going: You have a host configuration of 172.16.10.33 255.255.255.248. What subnet, broadcast address, and valid host range is this host a member of?
256-248=8, 16, 24, 32, 40

Bingo! The host is in the 10.32 subnet, which has a broadcast address of 10.39 and valid host range of 10.33 through 10.38. Easy, huh?

One more: You have a host configuration of 172.16.10.17 255.255.255.252. What subnet, broadcast address, and valid host range is this host a member of?
256-252=4, 8, 12, 16, 20

Bingo! You have a subnet of 10.16, with a broadcast of 10.19 and valid host range of 10.17 through 10.18.

Conclusion
This Daily Drill Down presented a continuation of IP addressing and subnetting, which has taken many Daily Drill Downs to discuss. I am still not done! My future Daily Drill Downs will discuss IP routing, which is the process of fragmenting packets of data and switching them through an internetwork.

To continue on with IP routing, you must have a fundamental understanding of the devices that work at each layer as well as IP addressing and subnetting. Look back and read my past Daily Drill Downs that include both Layer 2 and Layer 3 switching. For more in-depth information, please see my Sybex CCNA Study Guide.
18 comments
Kelsjm
Kelsjm

I know this article was written quite a while ago, but I just wanted to say it was very helpful for a group project in my Networking class. Thank you very much to the author!

hlongwane
hlongwane

It looks easy than what i use to think. Thanks Todd

andy_uk
andy_uk

this is rubbish its wrong!!! 255.255.255.192 gives 4 subnets if we include subnet zero, which are 0,64,128 & 192 being subnets. first host on each subnets and last host are 0.1,63.254/64.1,127.254/128.1,191.254/192.1,192.254 resp.

jturner37
jturner37

Presently taking Cisco Router configuration and Fundamentals of Networking classes. This has given me a little but better understanding of subnetting

skarnovski
skarnovski

Hi there, firstly I like to say that the subnetting Class C article was very well written and easily understandable. I am now trying to work out how to do Class B subnetting. I am stuck on something and was wondering if someone could shed some light on my problem. Basically, in Class C, to get the #Subnets, #Hosts we (taken from article) have a; "Class C mask of 255.255.255.240. = 240 in binary is 11110000, which means you have four subnet bits and four host bits. Using our math, we?d get the following: 24-2=14 subnets 24-2=14 hosts" But in the Class B example, he has written; 255.255.192.0 mask = 2-2=2 subnets 2-2=16,382 hosts per subnet Now, I can't figure out how he got 16,382 host from the sum 2-2=16,382. The number of subnets = 2, so that's 255.255.192.0 11000000.00000000 = 2 bits, to 2^2-2=2. I get that part, but how does he get 16,382 hosts. The sum does not indicate this. I'm obviously new to subnetting, so thanks for any help here. I understand the rest of the class b subnetting guide, just this little bit. If I'm unclear on anything, let me know. Thanks Spence

neimple
neimple

You see this article was written by someone on May 29, 2001. Earlier we never used the Upper and lower bound of subnet's . Thats in the classical Subnetting. But nowdays TCP/IP stack supprts the upper and lower limits. That is our 4 subnet's but taking first 2 bits are ( 00,01,10,11). According to classic IP routing rules you are not able to use the subnets with all zeros or ones in the network portion. However most modern machines have no trouble actually using the upper and lower subnets. And you just came to read here's somewhere 8+ years later this topic was written.

leenachatterjee
leenachatterjee

I want to correct you.In the above article there is a wrong concept. to illustrate this i would like to give a example. suppose you have a class b network and 255.255.192.0 subnet musk.as it is a class b network so we will only consider 192.0. the binary equivalent of 192.0 is 11000000.00000000. So the number of subnet is 2^2=4 (not, 2^2-2). number of host per subnet is 2^14-2 (As there are 6+8=14 zeroes)= 16,382. I have consulted both forauzen.tannenbaum networking books and http://www.cisco.com/en/US/tech/tk365./technologies_tech_note09186a0080093f33.shtml link.

munir_kohistani
munir_kohistani

256 represent what?????? in all calculation we subtract from 256 so what is 256 and what it represent

munir_kohistani
munir_kohistani

after reading the example i find himself as a master of IP subnetting

210Admin
210Admin

Questions - The number of subnets = 2, so that's 255.255.192.0 11000000.00000000 = 2 bits, to 2^2-2=2. I get that part, but how does he get 16,382 hosts. The sum does not indicate this. I know this is a old post but for anyone coming across this post that is asking the same questions heres how. 255.255.192.0 in binary = 11000000.00000000 (192.0) So if we take the equations 2^n-2 = # of subnets, there are 2 bits for subnets so it comes out to 2^2-2=2 subnets To find the number of hosts you need to count the number of host bits in the last 2 octets (since this is a Class B address) There are 14 host bits, we know this from counting the total number of zeros in the last 2 octets. Now we go to our equation to figure out the total number of hosts for each subnet. 2^n-2 (n is the number of host bits in the mask which is 14) 2^14-2 = two to the 14th power = 16384 - 2 = 16382 hosts I'm also new to subnetting so if i made any mistakes please post the mistake

andy_uk
andy_uk

look at the mask 255.255.192.0 u hav 2*2= subnets (b class address subneting happens on 3rd oct.)192=11000000 u hav 2*14-2 hosts 255.255-network bits (B class=16 bits) 192.0 (host bits in general) 11000000.00000000 are host bits ( 11 are subnet bits so rest of the 0s are pure host bits) hope u get it now!

neilb
neilb

The sum reads as 2-2 but should be 2^n-2 where n is the number of bits. In the 255.255.192.0 address there are 14 host bits. 2^14-2 gives 16382. Run up Calc - if you're using Winders - and select the Scientific bit and you can easily check this.

skarnovski
skarnovski

Hi Neil, that's the missing link, or bit :) "2^n-2" yeh, that is easier to understand than 2-2. Got it now, thanks mate.

skarnovski
skarnovski

Thanks for the links mate. To be honest, I have about 12 webpages book-marked on Subnetting, but this tutorial, or article on this site has proven to be the easiest thus far. Anyway, have a nice day !

Editor's Picks