Risk Free Quote

OpenclarITy has a team of dedicated consultants who can provide customized IT solutions that assist you in meeting your business needs.

RISK FREE QUOTE

Understanding Network Subnetting

One of the biggest problems we find in regards to networking, is properly understanding subnetting. The main thing to remember about subnets and IP addresses is that even though they’re displayed in decimal for our convenience, they’re based on binary math.

To get a true understanding of where some of the numbers in your IP subnetting formulas come from, you need to know how to convert an IP address like 192.168.112.29 into binary. If you have not studied decimal to binary coversion than we do recommend you understand this before proceeding.

So below we will work through taking the IP address 192.168.112.29, and the subnet mask of 255.255.224.0, and calculate the first and last IPs in the range, as well as the subnet address and broadcast address.

To do this you only need one formula. There is another we use to help with this, but it’s something of a “cheat”. It’s a good cheat, though, and just makes your life easier. It is the type of thing you can use when calculating subnets at any time.

The formulas are:

2^x-2=y (two to the power of “x”, minus two, equals “y”)

256-subnet mask (two hundred fifty six minus subnet mask)

You're probably thinking "X"?.."Y"? Well dont worry we will explain where exactly the X and Y come from. Where we’re always dealing with binary, the math is always “two to the power of” something (x). In this case, X is the number of bits on the host addressing side of your subnet mask. Here’s what the IP and subnet above look like in binary:

IP address = 00001010.11100110.01110000.00011101
Subnet mask = 11111111.11111111.11100000.00000000

Notice how the subnet mask takes a pattern of all ones, then all zeroes. This is quite intentional, as it’s what your PC uses to determine the network portion and host portion of your IP address. The value “X” in the formula above comes from the number of zeroes in your subnet mask. For example:

2^13-2=y (two to the power of 13, minus two, equals y)

It’s more than acceptable to use a calculator for calculations like this. Running this through the calculator gives us 8190.

This number is the number of valid IP addresses in your subnet range. So, after running this formula you know that there are eight thousand one hundred ninety valid addresses to work with, using that subnet mask.

The cheat formula (256-subnet mask) shows us our beginning addresses using the mask in question. In this case:

256-224=32

(note that you only use the “non 255 or 0” number in this formula. The position of the 224 in this case also shows us the octet to work in. In this case the third octet).

We can now take our starting IP (192.168.112.29) as a reference, and show the different subnet addresses we have to work with here. Remember that the position of the non 255 or 0 number in the mask shows you what octet to work in. You can confirm that by looking at the binary IP and Subnet mask above:

192.168.0.0
192.168.32.0
192.168.64.0
192.168.96.0
192.168.128.0
192.168.160.0
192.168.192.0
192.168.224.0

So, using both formulas shows us that we can potentially have 8 different subnets, each with 8190 valid IP addresses in each.

With the IP address we’ve been given, though, we know that the subnet we need to work with is 192.168.96.0.

As you know, the very first IP in a subnet is unusable, as it’s the subnet identifier address, and represents the whole subnet. In this case it’s 192.168.96.0. Therefore, the first usable address is 192.168.96.1, which you know. The last IP in this range (the broadcast address) is of course the first one before our new subnet (192.168.128.0), therefore it is 192.168.127.255. Knowing this, we just count back one more to find the last usable IP address in the range: 192.168.127.254.

So, in summary, if we know an IP address (192.168.112.29) and the subnet mask (255.255.224.0), by using these two formulas we can find out:

The number of valid IPs: 8190
The subnet address: 192.168.96.0
The first usable IP: 192.168.96.1
The last usable IP: 192.168.127.254
The broadcast address: 192.168.127.255

Do not feel bad if this is not yet making sense. It certainly takes some time to learn this. It’s isn’t that it’s very hard; it’s just not intuitive for folks who’ve been raised on 10-based decimal math. The main thing to do is practice. Once you start seeing the numbers come together when applying these formulas, it all begins to make a good bit of sense.

A great resource in the never ending battle to understanding subnetting is the following website. This website provides tutorials, exercises and videos, all free of charge!

http://www.learntosubnet.com/