Calculating IPv4 Subnets in your Head without using Binary

I’ll never forget the first time I sat through a lecture on how to calculate IPv4 subnets. I understood the difference between class A, B, and C addresses along with their associated default subnet masks. I also understood the concept of borrowing eight bits while subnetting. That part was easy. However, when it came to borrowing less than eight bits, I had no choice but to do the binary calculations. That’s when my head began to hurt. No matter how careful I was converting decimal to binary and back again, if I made a mistake, there was no way to validate my answer. So, I resorted to doing the math twice to see if I came up with the same answer. Obviously, that was not very efficient and I needed to find a faster way to come up with the answer.

In order to help visualize what I was trying to accomplish, I decided to create a spreadsheet listing the subnets. When I borrowed one bit, and converted binary to decimal, I noted that there were two subnets (0 and 128). When I borrowed two bits, there were four subnets (0, 64, 128, and 192). That’s when the light bulb went off and I realized that the spreadsheet was no longer necessary. Subnets are always multiples of 128, 64, 32, 16, 8, 4, 2, and 1. Holy guacamole, I thought, it can’t be that easy. Oh, but it is. If you memorize the following table, you can easily calculate subnets in your head.

Subnet Table

Subnet Table

Subnet Table

The first row represents the eight bit positions within an octet. The second row shows the multiple of the octet that you are borrowing bits from. The third row displays the subnet mask that corresponds with the number of bits borrowed. Finally, the fourth row shows the wildcard mask, which is the inverse of the subnet mask (255 – Subnet Mask = Wildcard Mask). For example, if you wanted to create an access list to filter a subnet using a subnet mask of 255.255.255.224, you would use 0.0.0.31 as the wildcard mask. Of course, if you want to use a discontiguous wildcard mask, then you must calculate it in binary bit by bit.

Subnet Example (255.255.255.224 or /27)

Subnet Pie Chart

Subnet Pie Chart

The example in the pie chart illustrates the subnets derived (Multiples of 32) when three bits are borrowed in the forth octet. The numbers in black represent the subnet boundaries; the broadcast address for each subnet is displayed in red, and the range of hosts in blue.

Using this method for calculating subnets, instead of binary, will save you much needed time when taking a Cisco certification test.

Dan About Dan

Dan Stanton is a Cisco Certified Systems Instructor and has been teaching for Ascolta since 1995.

Visit Ascolta For Your Cisco Training Needs     Read More »