There are a wide range of techniques people use to work out their network, host and broadcast addresses. I prefer to take the binary approach as I find it the quickest and easiest method, and is never wrong.
Remember, the four most important things to know about a subnet is the following:
- Network Address:
- First Usable Address:
- Last Usable Address:
- Broadcast Address:
Let’s say for example, we were given the IP address 18.104.22.168 and told that it is in a /30. This is how I’d go about filling in the template above…
First of all, as IP addresses are 32 bits long, and each octet is 8 bits in length, we know that:
- Bits 0 to 8 are covered in the first octet.
- Bits 9 to 16 are covered in the second octet.
- Bits 17 to 24 are covered in the third octet.
- Bits 25 to 32 are covered in the fourth octet.
So, as this subnet address has 30 bits in it, we know we’re dealing with the fourth octet.
Now, because know bits 25 to 30 are subnet bits (referred to as SN below), we also know that the remaining two bits are host bits (referred to H below). Here is what it looks like when written down:
Now let’s replace the bit numbers with their values:
Now, let’s replace the x’s with the value of the fourth octet in the address, which in this case, is 159.
If you are wondering how I came up with the above, it is very simple. All I did was:
- Subtract 128 from 159, which left me with 31
- I then subtracted 16 from 31, whcih left me with 15
- I then subtracted 8 from 15, which left me with 7
- I then subtracted 4 from 7, which left me with 3
- I then subtracted 2 from 3, which left me with 1
- I then subtracted 1 from 1, which left me with 0
Note: While this may sound overly complicated, it is actually very quick and easy to do when doing it on a piece of paper.
Now to find out the network address all we do is add the SN bits that have a 1 underneath them, together. (128 + 16 + 8 + 4 = 156).
When you add this 156 to the first three octets of the address, we’re left with the Network Address 22.214.171.124.
Now, as we know that the first usable address is always the Network Address plus one, all we need to do is perform the following calculation: (156 + 1 = 157).
This gives us a First Usable Address of 126.96.36.199.
Now let’s skip the Last Usable Address for a moment and find the Broadcast Address. To find out what it is, all we need to do is add all of the H bits together (regardless of whether they are a 1 or a 0) and then add this number to the Network Address. (2 + 1 + 156 = 159).
This gives us a Broadcast Address of 188.8.131.52.
And finally, let’s work out the last usable address. This process is similar to finding the First Usable Address, however, instead of adding one to the network address, we actually subtract one from the Broadcast Address. (159 - 1 = 158).
This gives us a Last Usable Address of 184.108.40.206.
And there we have it! Our temaplte is complete. For easy reference, here it is again:
- Network Address: 220.127.116.11
- First Usable Address: 18.104.22.168
- Last Usable Address: 22.214.171.124
- Broadcast Address: 126.96.36.199
Other Posts in this Series:
See the Subnetting Made Easy - Index post for links to all of the posts in this series.
As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at email@example.com, or drop me a message on Reddit (OzNetNerd).
Note: The opinions expressed in this blog are my own and not those of my employer.