Easy to remember subnetting trick
01 Mar 2019
If you are related to the world of networking, you would of course have had to subnet at some point of your career. Though it is rare that you may have to do it without the help of the internet, I am willing to bet that at least most you would have had to do this at least once ( maybe in an interview? ).
Here is a neat trick that I like to use as a little cheat for subnetting without using a calculator.
What I do is, I consider the IP addresses as memory units, specifically megabytes. You dont even have to be from the world of computers to be familiar with these memory units.
1 IP Address = 1 MiB
Generally in storage devices like flash drives, memory cards and so on, we see the storage capacity incrementing as exponents of 2. The same can be applied in subnetting.
With this I came up with the below table.
|CIDR||Memory Unit||Number of IP addresses||Comments|
|/22||1 GiB||1024||Convert GiB to MiB|
|/13||1 TiB||524288||Convert TiB to Mib|
|/4||512 TiB||268435456||Convert PiB to Mib|
In any given subnet (except /32 which is one IP address), subtract 2 from the number of IP addresses and you get the number of usable IP addresses ( 1 network address and 1 broadcast address).
I agree that this method is not particularly useful with the larger subnets like /8, but this makes it easy to calculate the smaller ones. Anything below /18 is a piece of cake.
On a side note, contrary to popular belief, 1024 MB (Megabyte ) is not equal to 1 GB (Gigabyte). 1000 MB = 1 GB.
The memory units used are Mebibyte (MiB) , Gibibyte (GiB) , Tebibyte (TiB) and Pebibyte (PiB).
1024 MiB = 1 GiB 1024 GiB = 1 TiB 1024 GiB = 1 PiB
Hope this was useful.