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.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays