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 18.104.22.168/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 22.214.171.124/28 is the closest one for the previous IP address.
Starting with 126.96.36.199/28 up to 188.8.131.52/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 184.108.40.2066.
Broadcast address = Next Subnet - 1 Last host = Next Subnet - 2
From the previous example:
Subnet: 220.127.116.11/28 Last Host: 18.104.22.168/28 Broadcast: 22.214.171.124/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.