How to calculate network and broadcast address

Table of contents:

How to calculate network and broadcast address
How to calculate network and broadcast address
Anonim

If you are going to configure a network, then you need to know how to distribute it. To do this, you need to know the network and broadcast addresses of the network. Follow the steps below to find out how to compute these addresses if you have an IP address and subnet mask.

Steps

Method 1 of 3: For classful addressing

Step 1. For a class-based network, the total number of bits is 8

Or Tb = 8.

  • The subnet mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
  • 1636270 1b1
    1636270 1b1
  • The table below allows you to determine the "number of bits used for subnets" (n) for the corresponding subnet mask.
  • 1636270 1b2
    1636270 1b2
  • The default subnet mask value is 255. It is not used to separate subnets.
  • Example:

    Let the IP address be 210.1.1.100 and the subnet mask 255.255.255.224

    Total number of bits Tb = 8 Number of bits used for subnets n = 3 (since the subnet mask is 224 and the corresponding "number of bits used for subnets" from the table above is 3)

    1636270 1b4
    1636270 1b4
1636270 2
1636270 2

Step 2. From the previous step, you have the "number of bits used for subnets" (n) and you know Tb.

Now you can find the "number of bits remaining for hosts" (m) equal to Tb - n, since the total number of bits is the sum of the bits for subnets and hosts Tb = m + n.

  • Number of bits remaining for hosts = m = Tb - n = 8 - 3 = 5

    1636270 2b1
    1636270 2b1
1636270 3
1636270 3

Step 3. Now you need to calculate the "number of subnets" equal to 2, and "the value of the last bit used for the subnet mask", which is 2m.

The number of hosts per subnet is 2m - 2.

  • Number of subnets = 2 = 23 = 8

    The last bit used for the subnet mask = Δ = 2m = 25 = 32

    1636270 3b1
    1636270 3b1
1636270 4
1636270 4

Step 4. Now you can find the previously calculated number of subnets by dividing them by the "last bit used for subnet mask" value or Δ-address

  • The 8 subnets (as we calculated in the previous step) are shown above.
  • Each of them has 32 addresses.
1636270 5
1636270 5

Step 5. Now you need to determine which network your IP address is on

The first address on this subnet will be the network address, and the last will be the broadcast address.

  • Here we have selected the IP address 210.1.1.100. It is on the subnet 210.1.1.96 - 210.1.1.127 (see the previous table). Therefore, 210.1.1.96 is the network address, and 210.1.1.127 is the broadcast address for the selected IP address 210.1.1.100.
  • 1636270 5b1
    1636270 5b1

Method 2 of 3: For Classless Addressing (CIDR)

Step 1. In CIDR networks, the IP address is followed by a one-bit subnet prefix, separated by a forward slash (/)

you will need to convert it to dotted quad format. Follow the steps below to do this.

  1. Write down the prefix in the format shown below.
  2. 1636270 6b1
    1636270 6b1
    • If the prefix is 27, write it down as 8 + 8 + 8 + 3.
    • If it's 12, write it down as 8 + 4 + 0 + 0.
    • By default, it is 32, which is written as 8 + 8 + 8 + 8.
  3. Convert the corresponding bits using the table below and write the value in four-part format.
  4. 1636270 6b2
    1636270 6b2
  5. Let our IP address be 170.1.0.0/26. Using the table above, you can write:
  6. 26 = 8 + 8 + 8 + 2
    255 . 255 . 255 . 192

    The IP address is now 170.1.0.0, and the subnet mask is in four-part dotted format 255.255.255.192.

    1636270 6b3
    1636270 6b3

    Step 2. Total number of bits = Tb = 8.

    • The subnet mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
    • The table below allows you to determine the "number of bits used for subnets" (n) for the corresponding subnet mask.
    • 1636270 7b2
      1636270 7b2
    • The default subnet mask value is 255. It is not used to separate subnets.
    • From the previous step, our IP is 170.1.0.0 and our subnet mask is 255.255.255.192

      Total number of bits = Tb = 8 Number of bits used for subnets = n = 2 (since the subnet mask is 192 and the corresponding "number of bits used for subnets" from the table above is 2).

      1636270 7b4
      1636270 7b4
    1636270 8
    1636270 8

    Step 3. From the previous step, you have the "number of bits used for subnets" (n) and you know Tb.

    Now you can find the "number of bits remaining for hosts" (m) equal to Tb - n, since the total number of bits is the sum of the bits for subnets and hosts Tb = m + n.

    • Number of bits remaining for hosts = m = Tb - n = 8 - 2 = 6
    1636270 9
    1636270 9

    Step 4. Now you need to calculate the "number of subnets" equal to 2, and "the value of the last bit used for the subnet mask", which is 2m.

    The number of hosts per subnet is 2m - 2.

    • Number of subnets = 2 = 22 = 4

      The last bit used for the subnet mask = Δ = 2m = 26 = 64

      1636270 9b1
      1636270 9b1

    Step 5. Now you can find the previously calculated number of subnets by dividing them by the "last bit used for subnet mask" value or Δ-address

    • We get 4 subnets (as we calculated in the previous step)
    • 1636270 10b1
      1636270 10b1
    • Each of them has 64 addresses.
    • 1636270 10b2
      1636270 10b2
    1636270 11
    1636270 11

    Step 6. Now you need to determine which network your IP address is on

    The first address on this subnet will be the network address, and the last will be the broadcast address.

    • Here we have selected the IP address 170.1.0.0. It is on subnet 170.1.0.0 - 170.1.0.63 (see previous table). Therefore, 170.1.0.0 is the network address, and 170.1.0.63 is the broadcast address for the selected IP address 170.1.0.0.
    • 1636270 11b1
      1636270 11b1

    Method 3 of 3: Using an online calculator

    Step 1. Find the IP address and subnet mask

    On a Windows computer, you can do this by entering the "ipconfig" command (without quotes) at a command prompt. The IP address will appear next to the IPv4 address, and the subnet mask can be found on the line below. On a Mac, you can find the IP address and subnet mask in System Preferences under Network. Step 2. Go to

    You can use any browser, regardless of which system your computer is running. Step 3. In the "IP address" field, enter the appropriate values.

    The website will try to automatically detect your network address. Make sure the values are correct. Otherwise, enter the correct address. Step 4. In the "Mask" field, enter the subnet mask.

    Again, the site will automatically try to calculate these values. Make sure the data is correct. The subnet mask can be entered in either CIDR format (24) or four-part dotted format (255.255.255.0). Step 5. Click Calculate.

    It's a blue button opposite the Mask field. The network address will be listed below in the “Network” section, and the broadcast address will be listed in the “Broadcast” section.

    Examples of

    For class addressing

    • IP Address = 100.5.150.34 and Subnet Mask = 255.255.240.0

      Total number of bits = Tb = 8

      Subnet mask 0 128 192 224 240 248 252 254 255
      Number of bits used for subnets (n) 0 1 2 3 4 5 6 7 8

      Number of bits used for subnetting for mask 240 = n1 = 4

      (since the subnet mask is 240 and the corresponding "number of bits used for subnets" from the table above is 4)

      Number of bits used for subnetting for mask 0 = n1 = 0

      (since the subnet mask is 0 and the corresponding "number of bits used for subnets" from the table above is 0)

      Number of bits remaining for hosts for mask 240 = m1 = Tb - n1 = 8 - 4 = 4

      Number of bits remaining for hosts for mask 0 = m2 = Tb - n2 = 8 - 0 = 8

      Number of subnets for a mask 240 = 2 1 = 24 = 16

      Number of subnets for mask 0 = 2 2 = 20 = 1

      The last bit used for the subnet mask for mask 240 = Δ1 = 2m1 = 24 = 16

      The value of the last bit used for the subnet mask for mask 0 = Δ2 = 2m2 = 28 = 256

      For subnet mask 240, the addresses will be split by 16, and for mask 0, there will be 256. Using the values of Δ1 and Δ2, we get 16 subnets 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

      The IP address 100.5.150.34 belongs to the subnet 100.5.144.0 - 100.5.159.255, so 100.5.144.0 is the network address and 100.5.159.255 is the broadcast address

    For Classless Addressing (CIDR)

    • IP address in the CIDR network = 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 number of bits = Tb = 8

      Subnet mask 0 128 192 224 240 248 252 254 255
      Number of bits used for subnets (n) 0 1 2 3 4 5 6 7 8

      Number of bits used for subnetting for mask 128 = n1 = 1

      (since the subnet mask is 128 and the corresponding "number of bits used for subnets" from the table above is 1)

      Number of bits used for subnetting for mask 0 = n2 = n3 = 0

      (since the subnet mask is 0 and the corresponding "number of bits used for subnets" from the table above is 0)

      Number of bits remaining for hosts for mask 128 = m1 = Tb - n1 = 8 - 1 = 7

      Number of bits remaining for hosts for mask 0 = m2 = m3 = Tb - n2 = Tb - n3 = 8 - 0 = 8

      Number of subnets for mask 128 = 2 1 = 21 = 2

      Number of subnets for mask 0 = 2 2 = 2 3 = 20 = 1

      The last bit used for the subnet mask for mask 128 = Δ1 = 2m1 = 27 = 128

      Number of hosts per subnet = 2m1 - 2 = 27 - 2 = 126

      The value of the last bit used for the subnet mask for mask 0 = Δ2 = Δ3 = 2m2 = 2m3 = 28 = 256

      Number of hosts per subnet with mask 0 = 2m2 - 2 = 2m3 - 2 = 28 - 2 = 254

      For subnet mask 128, the addresses will be split by 128, and for mask 0 there will be 256. Using the values of Δ1 and Δ2, we get 2 subnets below

      200.0.0.0 - 200.127.255.255 200.128.0.0 - 200.255.255.255

      The IP address 200.222.5.100 belongs to the subnet 200.128.0.0 - 200.255.255.255, and therefore 200.128.0.0 is the subnet address and 200.255.255.255 is the broadcast address

    Advice

    • On CIDR networks, once you have converted the prefix to four-part format, you can use the same method as for class-based networks.
    • This method only works for IPv4 type networks and is not suitable for IPv6.

Popular by topic