In this post, I will share how to subnet a class B address with two examples. Since class B uses two octets for the host bit, I will show two examples one from each octets. Let's get going.
Range of class B address: first of all, be reminded that any IP whose values in the first octet fall between 128 and 191, is a class B address.
Example 1: Given 172.16.12.0/19, determine the following:
(i) The number of subnets that the given address and subnetmak will produce.
(ii) The number of hosts per each of the subnets generated in (i) above
(iii) Using a table, list all subnets, first and last valid IPs, and broadcast address
First thing to do is write the subnetmask from the given slash notation: /19 will be 255.255.224.0 (8 bits on is 255 and 3 bits on is 224, remember?)
(i) To determine the number of subnets, use 2^X, where X is equal to the number of bits borrowed. This will give 2^3=8 (the default subnetmask for B is 16 but in this example, we are given /19, meaning that we borrowed 3.) So our number of subnets will be 8. Question one answered.
(ii) To determine the number of host per subnet, use 2^Y-2, where Y equals the number of bits off. This will give 32-19=13 (IPv4 is a 32-bit address format and in this example, 19 bits are turned on) Now, that will have 13 off, we will substitute that into the equation, giving us 2^13-2=8,190. We will have 8,190 hosts per subnets (the -2 is for the network and broadcast addresses that we can't assign to hosts on the networks).
(iii) To list out the subnets, we will need a block size. Block size=256-224, which gives us 32. (to get your block size, simply substitute the value of the subnet bits from 256. 256 is a constant value). Now, that we have a block size of 32, we can list our subnets in block size of 32, starting from subnet zero (back in the days, IP subnet zero was not used except you turn it on yourself on the router. Now, IP subnet zero is turned by default and so, you can use the zero subnet)
Example 2. Given 172.16.0.0/26, determine the following:
(i) Number of unique subnets that the given address and subnetmask will produce
(ii) Number of hosts per subnet
(iii) List all subnets, valid IP addresses and their broadcast.
I chose /26 because with it, the subnet bit falls into the fourth octet, which will be different from the first example where it fell into the third octet.
First, the subnetmask will be 255.255.255.192
(i) Number of subnet will be 2^X where X equals the number of borrowed bits. This will give us 2^10=1024 (again, the default for class B is 16 but in this example, we have /29. So when you substitute 16 from 29, you have 10). Answer to question (i) is 1024 subnets.
(ii) How many hosts per subnet? To get this, we use the formula 2^Y-2 where Y equals the number of off bits. This gives us 2^6-2=62 (again, IPV4 is a 32-bit address and we are given /29. That leaves us with 6 bits off).
(iii) Block size will be 256-192 which will give us 62. With that, we list our subnets in blocks of 62.
First eight subnets
Last eight subnets
If you have any question on this or other issues, please use the comment box. Thanks.