Obtaining Network ID, Broadcast address and usable IP addresses from a given IP address

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
Step 1: The /29 means 29 bits are turned on, i.e. 11111111.11111111.11111111.11111000 from this we get the subnet
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:
Broadcast address is: Last bock size 56 – 1 = 55 (
Usable IP range: 6
Usable IP addresses:

Second Way: We will consider the same IP address
Step 1: Get the subnet mask, which is
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.

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:  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 belong to?



Third Way: We will consider the same IP address
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. (ip address)
10100000.01011000.11000000.00110010 (mask)
10100000.01011000.11000000.00110000 Result of AND operation.
=========================================== (network address)