How to calculate ip range by ip address and mask address

Example 10.0.0.50/22

  1. convert your address to binary (8bits each number)
decimalbinary
10.0.0.5000001010.00000000.00000000.00110010
22 (means 1(binary) with 22 bits)11111111.11111111.11111100.00000000
  1. get network address by AND calculation
00001010.00000000.00000000.00110010 (ip)
AND
11111111.11111111.11111100.00000000 (mask)
=
00001010.00000000.00000000.00000000 (network address: 10.0.0.0)
  1. reverse your netmask address
11111111.11111111.11111100.00000000 (mask)

00000000.00000000.00000011.11111111 (netmask reversed)
  1. get broadcast address by OR calculation
00001010.00000000.00000000.00110010 (ip)
OR
00000000.00000000.00000011.11111111 (netmask reversed)
=
00001010.00000000.00000011.11111111 (broadcast address)

then we know the broadcast is 10.0.3.255, the available adreess range is 10.0.0.0 – 10.0.3.254

4 thoughts on “How to calculate ip range by ip address and mask address”

Leave a Reply

Your email address will not be published. Required fields are marked *