# Subnetting Class B

In this article we will understand IPv4 Class B subnetting. Let's begin by understanding basic definitions.

Before understanding Class B subnetting in detail, it is advised to have clear understanding of

__Definition of IP Address:__An IP address is a 32 bit number that logically defines a host. IP address assigned to a LAN card or a device interface can change based on network admin's requirement.__Definition of Subnet Mask:__Subnet Mask is a 32 bit value that defines which portion of an IP address is network and which portion is host.__Definition of Subnetting and its requirement:__Subnetting is extending the network portion and reducing the host portion. Advantage of Subnetting is that helps a network admin to efficiently use the network IPs.Before understanding Class B subnetting in detail, it is advised to have clear understanding of

**Subnetting Class C**Let's take example of a Class B Network 172.16.0.1/16. We will subnet this network from 172.16.0.0/16 till 172.16.0.254/30. Kindly note that default subnet mask of Class B is /16 (or 255.255.0.0).

Kindly note that subnet mask 255.255.0.0 can be written as /16. We can write /16 in binary as 11111111.11111111. 00000000.00000000. Here, number of 1s is 16 and we use this value to denote the subnet mask as /16. In Class B network shown above, we will have 16 Network bits (1s) and 16 host bits (0s) and using subnetting we will extend the network portion from 172.16.0.0/16 till 172.16.0.0/30.

Also note that the last 2 octets (3

While we change subnet mask from /16 to /17, the binary value of 3

Let assume the number of bits we have made turned '1' or borrowed = N( ex. Network bit), so here N= 1

Let assume the number of bits left zero(remaining) = H (ex. Host bit), so here H = 15.

Kindly note that subnet mask 255.255.0.0 can be written as /16. We can write /16 in binary as 11111111.11111111. 00000000.00000000. Here, number of 1s is 16 and we use this value to denote the subnet mask as /16. In Class B network shown above, we will have 16 Network bits (1s) and 16 host bits (0s) and using subnetting we will extend the network portion from 172.16.0.0/16 till 172.16.0.0/30.

## Subnetting Class B (172.16.0.0/17)

Let's begin subnetting by borrowing 1 bit (Most significant bit) from host portion and use it in the network portion. The subnet mask will become /17 (previous value was /16).Also note that the last 2 octets (3

^{rd}and 4^{th}octets) of network 172.16.0.0 can be written as 00000000.00000000While we change subnet mask from /16 to /17, the binary value of 3

^{rd}octet of subnet mask can be written as 10000000 while the binary value of 4^{th}octet will remain 00000000. The Decimal value of subnet mask will become 255.255.128.0, because the decimal value of 10000000 in 3^{rd}Octet is 128.Let assume the number of bits we have made turned '1' or borrowed = N( ex. Network bit), so here N= 1

Let assume the number of bits left zero(remaining) = H (ex. Host bit), so here H = 15.

The binary format of 3

^{rd}and 4^{th}octet will be : 10000000**.**00000000 (7 bits of 3^{rd}Octet are 0 and all 8 bits of 4^{th}octet are 0. So 7+8 = 15)## Important Formulas to calculate number of subnets and hosts per subnet

- Number of subnets = 2
^{N} - Number of hosts per subnet = (2
^{H}) - 2 - Block size of each subnet = 256 - Decimal value of new mask.

## Subnetting Class B (172.16.0.0/17)

Based on above rules let's calculate the values for 172.16.0.0/17

- Number of subnets (for /25 mask) = 2
^{N}

^{1}= 2 , So Number of subnets (for /25 mask) = 2

We will also discuss about range/value/block size of these subnets in this article shortly.

- Number of hosts per subnet = (2
^{H}) - 2

^{15}- 2

Hosts per subnet = 32768 - 2 = 32766.

- Block size of each subnet = 256 - 128 = 128

For /17 mask, we will get 2 subnets, each with 32766 hosts. Below is list of 2 subnets:

- 1st Subnet = 172.16.0.0/17
- 2nd Subnet = 172.16.128.0/17

Below is list of range of IP address of these subnets.

- For 1st Subnet, 1st valid IP is 172.16.0.1/17, last valid IP is 172.16.127.254/17, and broadcast IP is 172.16.127.127/17
- For 2nd Subnet, 1st valid IP is 172.16.128.1/17, last valid IP is 172.16.255.254/17, and broadcast IP is 172.16.255.255/17

## Subnetting Class B (172.16.0.0/23)

With mask /23, subnet mask will be 255.255.254.0. Binary value of 3^{rd}octet is 11111110 and 4

^{th}Octet is 00000000. Using this let’s proceed further.

- Number of subnets (for /23 mask) = 2
^{N}

^{7}= 128

Number of subnets (for /23 mask) = 128

- Number of hosts per subnet = (2
^{H}) - 2

^{rd}octet and 8 zero bits from 4

^{th}octet are available for host portion), so 2

^{9}- 2.

Hosts per subnet = (512 -2) = 510.

- Block size of each subnet = 256 - 254 = 2

For /23 mask, we will get 128 subnets, each with 510 hosts, each subnet has block size of 2. Below is list of all 128 subnets.

- 1
^{st}Subnet = 172.16.0.0/23 - 2
^{nd}Subnet = 172.16.2.0/23 - 3
^{rd}Subnet = 172.16.4.0/23 - 4
^{th}Subnet = 172.16.6.0/23 - 127
^{th}Subnet=172.16.252.0/23 - 128
^{th}Subnet=172.16.254.0/23

Below is list of range of IP address of these subnets.:

- For 1
^{st}Subnet, 1st valid IP is 172.16.0.1/23, last valid IP is 172.16.1.254/23, and broadcast IP is 172.16.1.255/23 - For 2
^{nd}Subnet, 1st valid IP is 172.16.2.1/25, last valid IP is 172.16.3.254/23, and broadcast IP is 172.16.3.255/23 - For 3
^{rd}Subnet, 1st valid IP is 172.16.4.1/23, last valid IP is 172.16.5.254/23, and broadcast IP is 172.16.5.255/23 - For 4
^{th}Subnet, 1st valid IP is 172.16.6.1/23, last valid IP is 172.16.7.254/23, and broadcast IP is 172.16.7.255/23 - For 127
^{th}Subnet, 1st valid IP is 172.16.252.1/23, last valid IP is 172.16.253.254/23, and broadcast IP is 172.16.253.255/23 - For 128
^{th}Subnet, 1st valid IP is 172.16.254.1/23, last valid IP is 172.16.255.254/23, and broadcast IP is 172.16.255.255/23

## Subnetting Class B (172.16.0.0/24)

With mask /24, subnet mask will be 255.255.255.0. Binary value of 3^{rd}octet is 11111111 and 4

^{th}Octet is 00000000. Using this let’s proceed further.

- Number of subnets (for /24 mask) = 2
^{N}

^{rd}Octet are borrowed for network portion), so 2

^{8}= 256

Number of subnets (for /24 mask) = 256

- Number of hosts per subnet = (2
^{H}) - 2

^{rd}octet are borrowed as 1 and 8 bits from 4

^{th}octet are zero) so 2

^{8}- 2.

Hosts per subnet = (256 -2) = 254.

- Block size of each subnet = 256 – 255(decimal value of 3
^{rd}octet with all 1s) = 1

For /24 mask, we will get 256 subnets, each with 254 hosts, each subnet has block size of 1. Below is list of all 256 subnets:

- 1
^{st}Subnet = 172.16.0.0/24 - 2
^{nd}Subnet = 172.16.1.0/24 - 3
^{rd}Subnet = 172.16.2.0/24 - 4
^{th}Subnet = 172.16.3.0/24 - 255
^{th}Subnet=172.16.254.0/24 - 256
^{th}Subnet=172.16.255.0/24

Below is list of range of IP address of these 256 subnets:

- For 1
^{st}Subnet, 1st valid IP is 172.16.0.1/24, last valid IP is 172.16.0.254/24, and broadcast IP is 172.16.0.255/24 - For 2
^{nd}Subnet, 1st valid IP is 172.16.1.1/24, last valid IP is 172.16.1.254/24, and broadcast IP is 172.16.1.255/24 - For 3
^{rd}Subnet, 1st valid IP is 172.16.2.1/24, last valid IP is 172.16.2.254/24, and broadcast IP is 172.16.2.255/24 - For 4
^{th}Subnet, 1st valid IP is 172.16.3.1/24, last valid IP is 172.16.3.254/24, and broadcast IP is 172.16.3.255/24 - For 255
^{th}Subnet, 1st valid IP is 172.16.254.1/24, last valid IP is 172.16.254.254/24, and broadcast IP is 172.16.254.255/24 - For 256
^{th}Subnet, 1st valid IP is 172.16.255.1/24, last valid IP is 172.16.255.254/24, and broadcast IP is 172.16.255.255/24

## Subnetting Class B (172.16.0.0/26)

With mask /26, subnet mask will be 255.255.255.192. Binary value of 3^{rd}octet is 11111111 and 4

^{th}Octet is 11000000. Using this let’s proceed further.

- Number of subnets (for /26 mask) = 2
^{N}

N = 10, (2 bits are borrowed from host portion), so 2

Number of subnets (for /26 mask) = 1024

^{10}= 1024Number of subnets (for /26 mask) = 1024

- Number of hosts per subnet = (2
^{H}) - 2

^{th}octet are left zero), so 2

^{6}- 2.

Hosts per subnet = (64 -2) = 62.

To find Block Size, we need to be careful in calculating the block size because block size for 172.16.0.0/26 will be calculated from 3

^{rd}and 4

^{th}octets both.

- Block size from 3
^{rd}Octet is 1 and Block size from 4^{th}Octet is 64. I know you have got confused. But once you look the example below, things will be clearer. - Block size of each subnet(3
^{rd}Octet) = 256 – 255 =1 (decimal value of 3rd octet with all 1s). - Block size of each subnet (4
^{th}Octet) = 256 – 192 = 64 (decimal value of 4^{th}octet with two 1s).

For /26 mask, we will get 1024 subnets, each with 62 hosts, each subnet has block size of 64. Below is list of all 1024 subnets:

- 1
^{st}Subnet = 172.16.0.0/26 - 2
^{nd}Subnet = 172.16.0.64/26 - 3
^{rd}Subnet = 172.16.0.128/26 - 4
^{th}Subnet = 172.16.0.192/26 - 5
^{th}Subnet = 172.16.1.0/26 - 6
^{th}Subnet = 172.16.1.64/26 - 7
^{th}Subnet = 172.16.1.128/26 - 8
^{th}Subnet = 172.16.1.192/26 - 9
^{th}Subnet = 172.16.2.0/26 ^{10th}Subnet = 172.16.2.64/26^{11th}Subnet = 172.16.2.128/26- 12
^{th}Subnet = 172.16.2.192/26 - 1021
^{st}Subnet = 172.16.255.0/26 - 1022
^{nd}Subnet = 172.16.255.64/26 - 1023
^{rd}Subnet = 172.16.255.128/26 - 102
^{4th}Subnet = 172.16.255.192/26

Below is list of range of IP address of these 1024 subnets.:

- For 1
^{st}Subnet, 1st valid IP is 172.16.0.1/26, last valid IP is 172.16.0.62/26, and broadcast IP is 172.16.0.63/26 - For 2
^{nd}Subnet, 1st valid IP is 172.16.0.65/26, last valid IP is 172.16.0.126/26, and broadcast IP is 172.16.0.127/26 - For 3
^{rd}Subnet, 1st valid IP is 172.16.0.129/26, last valid IP is 172.16.0.190/26, and broadcast IP is 172.16.0.191/26 - For 4
^{th}Subnet, 1st valid IP is 172.16.0.193/26, last valid IP is 172.16.0.254/26, and broadcast IP is 172.16.0.255/26 - For 5
^{th}Subnet, 1st valid IP is 172.16.1.1/26, last valid IP is 172.16.1.62/26, and broadcast IP is 172.16.1.63/26 - For 6
^{th}Subnet, 1st valid IP is 172.16.1.65/26, last valid IP is 172.16.1.126/26, and broadcast IP is 172.16.1.127/26 - For
^{7th}Subnet, 1st valid IP is 172.16.1.129/26, last valid IP is 172.16.1.190/26, and broadcast IP is 172.16.1.191/26 - For 8
^{th}Subnet, 1st valid IP is 172.16.1.193/26, last valid IP is 172.16.1.254/26, and broadcast IP is 172.16.1.255/26 - For 1021
^{st}Subnet, 1st valid IP is 172.16.255.0/26, last valid IP is 172.16.255.62/26, and broadcast IP is 172.16.255.63/26 - For
1022
^{nd}Subnet, 1st valid IP is 172.16.255.65/26, last valid IP is 172.16.255.126/26, and broadcast IP is 172.16.255.127/26 - For
1023
^{rd}Subnet, 1st valid IP is 172.16.255.129/26, last valid IP is 172.16.255.190/26, and broadcast IP is 172.16.255.191/26 - For
1024
^{th}Subnet, 1st valid IP is 172.16.255.193/26, last valid IP is 172.16.255.254/26, and broadcast IP is 172.16.255.255/26

I hope you have understood the concept of Class B subnetting. Kindly try the subnetting for 172.16.0.0/28. Kindly share this article with your friends too.

## 0 Comments

Please do not enter any spam link in the comment box.