There are many ways to understand subnetting. Here is a method that I use to figure out the IPv4 network address, the first address and the last broadcast address quite easily.
The following part requires understanding of the basic concepts of subnetting and binary math.
An IPv4 address is made up of 4 decimal numbers separated by dots.
Take 4.5.6.7 as an example:
Decimal | 4 | 5 | 6 | 7 |
Binary | 00000100 | 00000101 | 00000110 | 00000111 |
or 192.168.23.12:
Decimal | 192 | 168 | 23 | 12 |
Binary | 11000000 | 10101000 | 00010111 | 00001100 |
Each decimal number consists of 8 bits. Another name for 8 bits grouped together is an octet. Using these 8 binary bits we can count from 0 to 255 in decimal. As shown above, we have 8 bits x 4 groups which is 32 bits in total.
Adding some more information:
Decimal | 192 | 168 | 0 | 10 |
Binary | 11000000 | 10101000 | 00000000 | 00001010 |
Bit positions | 1-8 Octet 1 |
9-16 Octet 2 |
17-24 Octet 3 |
25-32 Octet 4 |
Possible decimal numbers | 0-255 | 0-255 | 0-255 | 0-255 |
When subnetting there are two important series of numbers to remember:
2^n = 1 2 4 8 16 32 64 128 255
And then there is:
256-(2^n) = 128 192 224 240 248 252 254 255
These numbers will show up all the time. More information on the “power of two” can be found here http://en.wikipedia.org/wiki/Power_of_two.
With all this is mind have a look at the following table:
Magic number | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Prefix bits – First octet | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Prefix bits – Second octet | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
Prefix bits – Third octet | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Prefix bits – Fourth octet | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
Subnet mask | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
The original can be found here http://www.networking-forum.com/practicesubnetting.php and it is an excellent tool to use at work, during your studies or at the next exam.
So how can we use this table for subnetting?
10.103.53.5/22
A prefix bit of 22 give us a subnet mask of 255.255.252.0.
The third octet in 10.103.0.0/22 is incremented by magic number 4.
- 10.103.0.0/22
- 10.103.4.0/22
- 10.103.8.0/22
- …
- 10.103.48.0/22
- 10.103.52.0/22
- 10.103.56.0/22
32 possible bits – 22 bit mask = 10 and 2^10 = 1024 IPv4 addresses within each subnet.
A prefix bit of 20 give us a subnet mask of 255.255.240.0.
The third octet in 10.103.0.0/20 is incremented by magic number 16
- 10.103.0.0/20
- 10.103.16.0/20
- 10.103.32.0/20
- 10.103.48.0/20
- 10.103.64.0/20
- 10.103.80.0/20
The first IPv4 address is 10.103.48.0. The last IPv4 address is 10.103.63.255.
32 possible bits – 20 bit mask = 12 and 2^12 = 4096 IPv4 addresses within each subnet.
10.103.53.5/11
Subnet mask is 255.224.0.0
The second octet is incremented by magic number 32 = 0 32 64 96 128 …
The first IPv4 address is 10.96.0.0
The last IPv4 address is 10.127.255.255
In total 32 – 11 = 21 and 2^21 = 2 097 152 IPv4 addresses.
10.103.53.5/13
Subnet mask 255.248.0.0
The second octet is incremented by magic number 8 = 0 8 16 … 80 88 96 104 112 …
First IPv4 address 10.96.0.0
Last IPv4 address 10.103.255.255
In total 32-13 = 19 and 2^19 = 524 288 IPv4 addresses.
10.103.53.5/26
Subnet mask is 255.255.255.192
The fourth octet is incremented by magic number 64 = 0 64 128 192 256
The first IPv4 address is 10.103.53.0
The last IPv4 address is 10.103.53.63
In total 32-26 = 6 and 2^6 = 64 IPv4 addresses.
10.103.53.5/28
Subnet mask 255.255.255.240
The fourth octet is incremented by magic number 16 = 0 16 32 …
First IPv4 address 10.103.53.0
Last IPv4 address 10.103.53.15
32 – 28 = 4 and 2^4 = 16 IPv4 addresses.
10.103.53.5/9
Subnet mask 255.128.0.0
The second octet is incremented by magic number 128 = 0 128 256
First IPv4 address 10.0.0.0
Last IPv4 address 10.127.255.255
32 – 9 = 23 and 2^23 = 8 388 608 IPv4 addresses.
Hope this was helpful to you!
Leave a Reply