Two addresses are subtracted from the number of hosts in each network because one is used for Net Id and other one is used for DBA of the network.
With directed broadcast, all recipients are always addressed within the target network. A combination of the number of the target network and the setting of all host bits to 1 produces the broadcast address in this case. If the destination is not located in its own (sub-) network, a router forwards the data packet.
Host bits are the part of an IP address identifying a specific host in a subnet. The subnet mask determines what proportion of the address is used for network bits and for host bits. For example, an IPv4 address 192.168.0.64/26 has a 6-bit host part because 26 of 32 bits are reserved for the network part.
The below diagram will show a picture on what we are going to do when evaluating an IP address and his CIDR. Remember that an IP address consists of 4 decimals – called octets – which are separated by points. One octet contains 8 bits, which is why IPv4 is a 32-bit address. Each octet can represent a number between 0 and 255.
In the below procedure we are going to discuss how to find out DBA of a network if a IP address is given. Following is the procedure of finding it.
- First we need to recognize the class of the IP address.
- Then according to the class of IP address, every class has a mask.
- There after we need to find the Net Id which is obtained by doing the bitwise AND of IP and mask.
- Then from obtained Net Id we can obtained the DBA of that network.
Above method can be illustrated by the following example:
Given, IP = 188.8.131.52. And, we have to find the DBA of the network.
It can be recognized that this IP belongs to Class C. Mask of Class C = 255.255.255.0.
In the following step Net Id is calculated by doing bitwise AND of IP (184.108.40.206) and mask (255.255.255.0):
201 AND 255 = 201 55 AND 255 = 55 63 AND 255 = 63 123 AND 0 = 0
Hence, Net Id for the specified IP is 220.127.116.11. Since Net Id is 18.104.22.168, the first host will be 22.214.171.124 and the laast host = 126.96.36.199. So the DBA of network will be 188.8.131.52.