Network Subnetting



Defining Subnets - Brien M. Posey

Subnetting is simply a technique for breaking a big block of IP addresses into smaller blocks that can be used to define separate networks. For example, suppose that you were able to obtain a class B block of IP addresses. Imagine that the address block that you received was 146.100.x.x. If you owned this particular block of addresses, your default subnet mask would be 255.255.0.0. This subnet mask tells TCP/IP that the first two digits of the IP address (146.100) are the network number, and the last two numbers are the host ID number. Since the last two numbers in the IP address can be used to identify individual hosts on the network, your IP address range will allow your network to contain up to 65,534 hosts!

That probably sounds great at first, but placing sixty five thousand hosts on a single network segment would be disastrous. If you have enough hosts to warrant using a class B address, you would probably be much better off breaking your single class B address into multiple class C addresses.

The easiest way of doing this is to change the subnet mask from 255.255.0.0 to 255.255.255.0. This would tell TCP/IP that the first three numbers in the IP address designate the network portion of the address and only the last digit is being used as the host address. You would then pick a number for the third digit of the first set of IP addresses. You would probably want to start with 0 if this were a real life situation. Therefore, your network number would be 146.100.0 and your hosts on that network would use IP addresses ranging from 146.100.0.0 to 146.100.0.254. When you run out of addresses on that block of IP addresses, simply increment the third digit of the IP address by 1 to define a new network segment. You can then create hosts with IP addresses ranging from 146.100.1.0 to 146.100.1.254.

Subnetting Class C Addresses

The technique that I just showed you works great if you want to evenly split a class A or a class B address block. Sometimes though, you may need to split a class C address block, or may need to divide a Class A or a Class B address in a way that would give you more or less addresses than you would get if you used the above technique.

In the above example, the numbers in the subnet mask were either 255 or they were zero. These numbers are actually derived from eight bit binary values. In binary math, 00000000=0, and 11111111=255. When we changed one of the numbers in the subnet mask from 0 to 255, we were borrowing eight bits from the address space. The trick to creating other types of subnets is to understand that you do not have to work in eight bit increments.

Suppose for example that you owned the class C address block 192.168.42.x, and you needed to split it into five subnets with 25 addresses each. Since this is a class C address, the host identifier portion of the IP address takes up 8 bits. If you want to subnet this address block, you will have to borrow some of the bits that are used for the host identifier and use them for the network identifier.

To determine how many bits you will have to use for a subnet, use the formula 2X-2, where X is the number of bits that you are using. For example, if you were to use 3 bits, then you could create six subnets (23-2=6). If you use three bits for the subnet, then that leaves you with five bits for the host identifier. If you apply the 2X-2 formula to the number of bits left for the host identifier, you will find that each subnet can contain up to 30 hosts (25-2=30).

As you will recall earlier when we subnetted the class B address, we had to increment the last portion of the network identifier for each subnet. We have to do the same thing here, but doing so is a little more difficult. As you will recall, the first three numbers in each IP address are 192.168.40. These numbers will remain constant. It’s only the last number that we have to worry about. We have split the last number into three bits for the network identifier, and five bits for the host identifier. We must now set the network identifier portion to 1. In binary form, it looks like this:

001 00000

The 1 will be incremented for each individual subnet. There are six subnets in all, and they will look like this:

001 00000
010 00000
011 00000
100 00000
101 00000
110 00000
111 00000

Now, you must determine the IP addresses that will fall into each subnet. The trick is to understand that the last five bits are used for the host identifier. They range from 00000 to 11111. To determine the IP addresses in each subnet, combine the network identifier with the host identifier and then convert it to decimal notation. For example, for the 001 subnet, the bit range is 001 00000 to 001 11111. When you concatenate these numbers they appear as 00100000 and 00111111. Convert these numbers to decimal and they become 33 and 62. This means that the IP address range for the first subnet is 192.168.40.33 to 192.168.40.62. You can repeat the process for the other subnets to calculate the IP address ranges for them.

The last step in the process is to compute the subnet mask. The old 255.255.255.0 isn’t going to work anymore because we borrowed three bits from the host identifier. The easiest way to come up with the subnet mask is to express the last number in binary notation, where the three bits that we have borrowed are expressed as ones and the bits that are being used for the host identifier are expressed as zero. This looks like: 11100000. Convert this value to decimal notation and the value is 224. As you will recall, the original subnet mask was 255.255.255.0. To create the new subnet mask, we simply replace the 0 with the new value (224). Our subnet mask becomes 255.255.255.224.


Leave a Comment

You must be logged in to post a comment.