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.
1 2 3
If I get the IP address 188.8.131.52/28 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 184.108.40.206/28 is the closest one for the previous IP address.
Starting with 220.127.116.11/28 up to 18.104.22.168/28. 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 22.214.171.1246.
Broadcast address = Next Subnet - 1 Last host = Next Subnet - 2
From the previous example:
Subnet: 126.96.36.199/28 Last Host: 188.8.131.52/28 Broadcast: 184.108.40.206/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.
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.4/27 .
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.