IPv4 network and broadcast addresses
In order to find the network and broadcast addresses of any given IPv4 address and subnet mask combination, do the following:
- for the network address, change all host-portion bits to 0
- for the broadcast address, change all the host-portion bits to 1
For example, take the following IP address assigned to a host:
- 125.16.72.113/26
The /26 corresponds to a subnet mask of
- 255.255.255.192
Convert the last octet of both the IP address and the subnet mask into binary for easier calculations:
125. 16. 72.01110001
255.255.255.11000000
Notice the 3rd to 8th bit of the subnet mask are zeros. This indicates the host portion of the address.
To get the network address, make the host portion (3rd to 8th bit) of the IP address zeros:
125. 16. 72.01000000
which in decimal is 125.16.72.64
To get the broadcast address, make the host portion (3rd to 8th bit) of the IP address ones:
125. 16. 72.01111111
which in decimal is 125.16.72.127