TCP/IP subnetting

 

If a company is assigned as a class B address the first 16 bits of that IP address is predetermined by InterNIC. This leaves the remaining 16 bits for host addresses on this network. The number of hosts can be found by raising 2 to the power of the number of bits, then taking away 2 from the result as all zeroes and all ones are not allowed in the host ID. This is because broadcasts make use of all zeroes and all ones. When broadcasts occur we do not want one device picking the data up and treating it as targeted information.

Number of hosts =(2^n)-2

In the case of 16 bits this would leave 65,534 possible hosts on the network. An administrator might prefer to have fewer hosts on the network but have more networks and so Subnet the existing network.


Subnetting means borrowing bits from the host ID to create more network ID’s. To indicate that this has happened the subnet mask also has to be updated. When working out the number of bits that must be sacrificed from the host ID portion of the address in order to provide the number of subnets needed, once again all zeroes and all ones are not allowed as they are broadcast addresses. This means it is necessary to take 2 away from the number of subnets created from a given number of bits. For the exam the best advice is to create the following table before starting the exam

Bits

2^2

2^2-2 (subnets)

Subnet mask

1

2

0

128 (10000000)

2

4

2

192 (11000000)

3

8

6

224 (11100000)

4

16

14

240 (11110000)

5

32

30

248 (11111000)

6

64

62

252 (11111100)

7

128

126

254 (11111110)

8

256

254

255 (11111111)


This table can easily be used to answer questions like the following.

You have a class B address and want to create 7 subnets. How many bits do you need to use, and what will your subnet mask be?

Looking at the table you can see that in the third column the smallest number of subnets that need to be created to support 7 subnets is actually 14. Therefore you need to use 4 bits from the host ID, leaving 12 for possible hosts. This would give the following subnet mask. 255.255.240.0
The number of hosts available after subnetting will be reduced, in the example above to (2^12 )–2 = 4094. A fairly significant reduction from 65,534.


The last task when deciding to subnet is to find the subnet ID’s. For example if you have a class B network and are using 3 bits to subnet you will have the following subnet mask.

255.255.224.0

The network ID’s can be quickly found by subtracting 224 from a base number of 256 and then incrementing by that value up to the subnet mask. Alternatively you can work out the valid network ID’s the long way.

The quick way:

256-224 = 32

Increment 32 until you get to the Subnet mask which is invalid

32 (00100000)
64 (01000000)
96 (01100000)
128 (10000000)
160 (10100000)
192 (11000000)

The next one would be invalid, it would equal the subnet mask (11100000) and that is all 1's !!!

This means everything between X.Y.32.1 and X.Y.63.254 will be on the same subnet. If you find this difficult to follow it is worth putting some values in for X and Y above and then AND with the subnet mask. You will find the results are the same, the devices are in the same subnet.


Supernetting

In a similar way to subnetting it is possible to borrow bits from the network ID to increase the number of hosts on the LAN. This is called Supernetting. Supernetting is usually performed on Class C network addresses and all of the addresses need to be matched to work in this scenario. Supernetting is also called Classless Interdomain Routing (CIDR).