IPv4 subnetting

During the preparation for the CCNA I had to brush up network subnetting. Finally I found a pretty straightforward way to calculate subnets. Here are some advices.

1. Finding subnet network, broadcast and last host

The simplest thing to do is to work with groups.

Prefix  /+1 /+2 /+3 /+4 /+5 /+6 /+7 +/8
Netmask 128 192 224 240 248 252 254 255
Group   128 64  32  16  8   4   2   1

If I get the IP address 191.10.10.24328 I know that the netmask is 255.255.255.240 what means I need to look for groups of 16 according to the table. Now you need to find the closest group to that IP address.

Here are the groups of networks base on the previous group. In this case the 191.10.10.24028 is the closest one for the previous IP address.

Starting with 191.10.10.0/28 up to 191.10.10.24028. Just moving on the third octed in groups of 16.

In order to find out the broadcast address and the last host available you just need to add the group number (16), trying to get the next subnet available which in this case would be 191.10.10.256.

Broadcast address = Next Subnet - 1
Last host = Next Subnet - 2

From the previous example:

Subnet: 191.10.10.240/28

Last Host: 191.10.10.254/28

Broadcast: 191.10.10.255/28

As you can see this is a very simple way to find out to what subnet an IP address belongs to.

2. Start splitting from higher prefix to lower

First and foremost, you need to know that subnetting is always done from higher to smaller prefix in order to avoid overlapping.

Assuming I want to split the next network 10.20.0.0/24 in several subnets I should start with the next biggest prefix I can use, /25, then I take this one and I split it in lower subnets.

10.20.0.0/25
10.20.0.128/25

The problem is when you decide to get first a smaller subnet and later a bigger one. For example, 10.20.0.0/30. Afterwards you start subnetting on what you think is the next subnet available which according with previous subnet you might think is 10.20.0.427 .

As you already may notice, this is wrong and it would match the range of ip addresses 10.20.0.1 - 10.20.0.30 what actually includes the IP addresses inside 10.20.0.0/30.

Nowadays I will normally use an IP calculator, however I find this an excellent work out for mental calculations.