Calculate Network and Broadcast Address

If you are going to set up a network, then you have to know how to distribute them. Knowing network and broadcast addresses is very essential to this process. Knowing how to calculate network and broadcast addresses if you have IP address and sub-net mask is also essential.

Steps

For Classful Network

  1. For a classful network total bits is 8. So Total bits = Tb = 8.
    • Sub-net mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
    • Below table gives you the "Number of bits used for subnetting"(n) to their corresponding subnet mask.
    • For subnet mask 255 is default, so it'll not consider for subnet masking.
    • For example:
      Let, IP address = 210.1.1.100 and Sub-net mask = 255.255.255.224

      Total bits = Tb = 8

      Number of bits used for subnetting = n = 3
      (as subnet mask = 224 and its corresponding "No. of bits used for Subnetting" is 3 from above table)
  2. From the previous step, you got the "Number of bits used for subnetting"(n) and you know the "Tb", then you can get "Number of bits left for host"(m) = Tb - n as total bits is the summation of number of bits used for subnetting and number bits left for host i.e. Tb = m+n.
    • Number of bits left for host = m = Tb - n = 8 - 3 = 5
  3. Now you have to calculate "Number of subnets" = 2n and "Value of last bit used for subnet masking"(Δ) = 2m. Number of host per subnet = 2m - 2.
    • Number of subnets = 2n = 23 = 8

      Value of last bit used for subnet masking = Δ = 2m = 25 = 32
  4. Now you can find previously calculated number of subnets by separating subnets each having "Value of last bit used for subnet masking" or Δ addresses.
    • The 8 subnets (as calculated in previous step) are shown above.
    • Each of them has 32 addresses.
  5. Now you have to find that your IP address is in which subnet, that subnet's first address is network address and last address is broadcast address.
    • Here the taken IP address is 210.1.1.100 . 210.1.1.100 comes in 210.1.1.96 - 210.1.1.127 subnet (see the previous step table). So 210.1.1.96 is network address and 210.1.1.127 is broadcast address for the taken IP address i.e. 210.1.1.100 . </ol>

      For CIDR

      1. In CIDR, you have a IP address followed by bit-length prefix separated by slash(/). Now you have to convert bit-length prefix to quad-dotted decimal representation. To do this follow below steps.
        1. Write the the bit-prefix in below format.
          • If it's 27, then write it as 8 + 8 + 8 + 3 .
          • If it's 12, then write it as 8 + 4 + 0 + 0 .
          • Default is 32, which is 8 + 8 + 8 + 8.
        2. Convert the corresponding bit according to the below table and represent in quad-dotted decimal format. </ul>
        3. Let an IP address be 170.1.0.0/26 . Using above table, you can write:

                              26 = 8 + 8 + 8 + 2
                                  255 . 255 . 255 . 192

          Now the IP address is 170.1.0.0 and subnet mask in quad-dotted decimal format is 255.255.255.192 . </ul>

      2. Total bits = Tb = 8.
        • Sub-net mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
        • Below table gives you the "Number of bits used for subnetting"(n) to their corresponding subnet mask.

        • For subnet mask 255 is default, so it'll not consider for subnet masking.
        • From the previous step, you got IP address = 170.1.0.0 and Sub-net mask = 255.255.255.192

          Total bits = Tb = 8

          Number of bits used for subnetting = n = 2
          (as subnet mask = 192 and its corresponding "No. of bits used for Subnetting" is 2 from above table)
      3. From the previous step, you got the "Number of bits used for subnetting"(n) and you know the "Tb", then you can get "Number of bits left for host"(m) = Tb - n as total bits is the summation of number of bits used for subnetting and number bits left for host i.e. Tb = m+n.
        • Number of bits left for host = m = Tb - n = 8 - 2 = 6
      4. Now you have to calculate "Number of subnets" = 2n and "Value of last bit used for subnet masking"(Δ) = 2m. Number of host per subnet = 2m - 2.
        • Number of subnets = 2n = 22 = 4

          Value of last bit used for subnet masking = Δ = 2m = 26 = 64
      5. Now you can find previously calculated number of subnets by separating subnets each having "Value of last bit used for subnet masking" or Δ addresses.
        • The 4 subnets (as calculated in previous step) are
        • Each of them has 64 addresses.
      6. Now you have to find that your IP address is in which subnet, that subnet's first address is network address and last address is broadcast address.
        • Here the taken IP address is 170.1.0.0 . 170.1.0.0 comes in 170.1.0.0 - 170.1.0.63 subnet (see the previous step table). So 170.1.0.0 is network address and 170.1.0.63 is broadcast address for the taken IP address i.e. 170.1.0.0 . </ol>

          Examples

          For Classful Network

          • IP address = 100.5.150.34 and subnet mask = 255.255.240.0
            Total bits = Tb = 8
            Subnet Mask 0 128 192 224 240 248 252 254 255
            No. of bits used for Subnetting (n) 0 1 2 3 4 5 6 7 8

            Number of bits used for subnetting for subnet mask 240 = n1 = 4
            (as subnet mask = 240 and its corresponding "No. of bits used for Subnetting" is 4 from above table)

            Number of bits used for subnetting for subnet mask 0 = n2 = 0
            (as subnet mask = 0 and its corresponding "No. of bits used for Subnetting" is 0 from above table)

            Number of bits left for host for subnet mask 240 = m1 = Tb - n1 = 8 - 4 = 4
            Number of bits left for host for subnet mask 0 = m2 = Tb - n2 = 8 - 0 = 8

            Number of subnets for subnet mask 240 = 2n1 = 24 = 16
            Number of subnets for subnet mask 0 = 2n2 = 20 = 1

            Value of last bit used for subnet masking for subnet mask 240 = Δ1 = 2m1 = 24 = 16
            Value of last bit used for subnet masking for subnet mask 0 = Δ2 = 2m2 = 28 = 256

            For subnet mask 240, addresses will be separated by 16 and for subnet mask 0, it'll be 256. Using Δ1 and Δ2 value, the 16 subnets are given below

            100.5.0.0 - 100.5.15.255 100.5.16.0 - 100.5.31.255 100.5.32.0 - 100.5.47.255 100.5.48.0 - 100.5.63.255
            100.5.64.0 - 100.5.79.255 100.5.80.0 - 100.5.95.255 100.5.96.0 - 100.5.111.255 100.5.112.0 - 100.5.127.255
            100.5.128.0 - 100.5.143.255 100.5.144.0 - 100.5.159.255 100.5.160.0 - 100.5.175.255 100.5.176.0 - 100.5.191.255
            100.5.192.0 - 100.5.207.255 100.5.208.0 - 100.5.223.255 100.5.224.0 - 100.5.239.255 100.5.240.0 - 100.5.255.255

            IP address 100.5.150.34 comes in 100.5.144.0 - 100.5.159.255 and hence 100.5.144.0 is the network address and 100.5.159.255 is the broadcast address.

          For CIDR

          • IP address in CIDR = 200.222.5.100/9
                                9 = 8 + 1 + 0 + 0
                                    255 . 128 . 0 . 0

            IP address = 200.222.5.100 and subnet mask = 255.128.0.0
            Total bits = Tb = 8

            Subnet Mask 0 128 192 224 240 248 252 254 255
            No. of bits used for Subnetting (n) 0 1 2 3 4 5 6 7 8

            Number of bits used for subnetting for subnet mask 128 = n1 = 1
            (as subnet mask = 128 and its corresponding "No. of bits used for Subnetting" is 1 from above table)

            Number of bits used for subnetting for subnet mask 0 = n2 = n3 = 0
            (as subnet mask = 0 and its corresponding "No. of bits used for Subnetting" is 0 from above table)

            Number of bits left for host for subnet mask 128 = m1 = Tb - n1 = 8 - 1 = 7
            Number of bits left for host for subnet mask 0 = m2 = m3 = Tb - n2 = Tb - n3 = 8 - 0 = 8

            Number of subnets for subnet mask 128 = 2n1 = 21 = 2
            Number of subnets for subnet mask 0 = 2n2 = 2n3 = 20 = 1

            Value of last bit used for subnet masking for subnet mask 128 = Δ1 = 2m1 = 27 = 128
            Number of host per subnet = 2m1 - 2 = 27 - 2 = 126

            Value of last bit used for subnet masking for subnet mask 0 = Δ2 = Δ3 = 2m2 = 2m3 = 28 = 256
            Number of host per subnet for subnet mask 0 = 2m2 - 2 = 2m3 - 2 = 28 - 2 = 254

            For subnet mask 128, addresses will be separated by 128 and for subnet mask 0, it'll be 256. Using Δ1, Δ2 and Δ3 value, the 2 subnets are given below

            200.0.0.0 - 200.127.255.255 200.128.0.0 - 200.255.255.255

            IP address 200.222.5.100 comes in 200.128.0.0 - 200.255.255.255 and hence 200.128.0.0 is the network address and 200.255.255.255 is the broadcast address.

          Tips

          • In CIDR, just after you convert the bit-length prefix to quad-dotted decimal format, you can follow the same procedure as for Classful network.
          • This method is only for IPv4, not applicable for IPv6.

          Related Articles

You may like