Subnetting example
After Lebyathans comment in the article “understanding ip addressing“, I have decided to give you an example of subnetting using the ip and subnet mask he mentioned. In this article you can see how we can find the network address, first valid host, last valid host, broadcast address, number of subnets and number of hosts in our network.
The Ip address is 192.168.5.33 and the mask is /27
First translate the mask from /27 to decimal form. /27 means 27 continuous 1’s in binary. It looks like this 11111111.11111111.11111111.11100000 and if we do the conversion to decimal the result is 255.255.255.224
Network address
Put the ip and the mask one on top of the other (Ip above and mask below).
Keep the ip portion above the 255.
192.168.5.33
255.255.255.224
192.168.5.?
In the tough part of the mask 224 do a conversion to binary 11100000.
Do the same to 33. The result must be 00100001
Now put the binary numbers one on top of the other (Ip above and mask below).
Keep unchanged the portion of the ip above the 1 part of the mask.
For the network address put 0 in the portion of the ip above the 0 part of the mask.
00100001
11100000
00100000
Now do the conversion of the new binary number 00100000 to decimal. The result is 32.
Put the 32 in the place of question mark (?) above and you’ve got the network address
192.168.5.32
First valid host
Add 1 to network address
192.168.5.32 + 1 = 192.168.5.33
Broadcast address
Put the ip and the mask one on top of the other (Ip above and mask below).
Keep the ip portion above the 255.
192.168.5.33
255.255.255.224
192.168.5.?
In the tough part of the mask 224 do a conversion to binary 11100000.
Do the same to 33. The result must be 00100001
Now put the binary numbers one on top of the other (Ip above and mask below).
Keep unchanged the portion of the ip above the 1 part of the mask.
For the broadcast address put 1 in the portion of the ip above the 0 part of the mask.
00100001
11100000
00111111
Now do the conversion of the new binary number 00111111 to decimal. The result is 63.
Put the 63 in the place of question mark (?) above and you’ve got the broadcast address
192.168.5.63
Last valid host
Subtract 1 from broadcast address
192.168.5.63 - 1 = 192.168.5.62
Number of subnets
To find the number of subnets we must first find the default subnet mask. For 192.168.5.33 the default subnet mask is 255.255.255.0. But we use the mask 255.255.255.224. Now just think how many 1 we have borrowed from the host portion of the default subnet mask.
255.255.255.224
255.255.255.0
We have borrowed 3 aces from the host part.
This means that we can create 23 - 2 subnets.
Number of hosts
To find the number of host we have to look how many zeros are left in the host portion of the mask.
255.255.255.224
If I convert the 224 to binary 11100000 I can see that the host part has 5 zeros. So the hosts are 25 - 2
With this way, no matter what Subnet mask and ip address they give to you, you are able to find all the information needed.
If you’ve found this article a bit hard to understand, please check our previous article named: Understanding Ip Addressing so you can first learn the basics of subnetting and then move to this more advanced example.
As allways, feel free to contact us through a comment or our contact form, to suggest new articles, ask a question or correct a mistake we have done.
None is perfect, and till next time…
No comments yet.