Let’s say you have been give an IP address and asked you to find out its Network ID, Broadcast and all usable IP addresses. How can you do it?
Well there are different ways to do it, but I will discuss two ways and I am particularly very interested to discuss the one that is easy and faster!
First Way: let’s assume that the given IP address is 188.8.131.52/29
Step 1: The /29 means 29 bits are turned on, i.e. 11111111.11111111.11111111.11111000 from this we get the subnet 255.255.255.248
Step 2: Now subtract the last octet of subnet mask from 256 to get the block size. 256 – 248 = 8 (block)
Step 3: Now increment the block by block starting from zero until it get more than the last octet of the given IP address (50), i.e. 0,8,16,24,32,40,48,56………
Step 4: Now one can see that the last octet of IP address 50 falls between block size 48 and 56, hence we get that:
Network ID is: 184.108.40.206
Broadcast address is: Last bock size 56 – 1 = 55 (220.127.116.11)
Usable IP range: 6
Usable IP addresses:
Second Way: We will consider the same IP address 18.104.22.168/29
Step 1: Get the subnet mask, which is 255.255.255.248
Step 2: Get the block size 256 -248 = 8 (block)
Step 3: Divide the last octet of IP address i.e. 50 by the block size i.e. 8 (50 / 8 = 6.25)
Step 4: Now truncate the decimal portion of the value 6.25 and multiply it by block size 8 (6 * 8 = 48)
Hence 48 is the network ID of the given IP address. 22.214.171.124
Note: This second way is little tricky sometimes. Because one might get a block size greater than the value in the octet to be divided. For example consider this IP address: 10.218.15.163 255.255.240.0 OR /20. The block size of this network is 16 and value in the octet is 15 hence we can’t divide this further. So the solution is one can follow the binary AND operation mentioned below or simply replace the octet and subsequent octet with zero.
Therefore, according to this rule the answer to this question:
Which subnet does host 10.218.15.163 255.255.240.0 belong to?
Third Way: We will consider the same IP address 126.96.36.199/29
Using bit wise AND operation and this is what exactly computers get the information.
Here the IP address and the subnet mask is converted into binary numbers and after performing bit wise AND operation, one will get the network address.
188.8.131.52 (ip address)
10100000.01011000.11000000.00110000 Result of AND operation.
184.108.40.206 (network address)