In order to set up a network, you must know how to share it. Knowing the network address and broadcast address is very important in this process. Knowing how to calculate network addresses and broadcast addresses if you have an IP address and a subnet mask is equally important.
Step
Method 1 of 2: For Classy Networks
Step 1. For a classy network, the total bytes is 8
So, total bytes = Tb = 8.
-
The subnet masks are 0, 128, 192, 224, 240, 248, 252, 254, and 255.
-
The table below shows the "Number of bits used for the subnet"(n) on the corresponding subnet mask.
- For subnet mask 255 is the default value. So, it is not taken into account for the creation of subnet masks.
-
Example:
IP address = 210.1.1.100 and subnet mask = 255.255.255.224
Total bytes = Tb = 8 The number of bytes used for subnetting = n = 3(because the subnet mask = 224 and the corresponding number of bytes used for subnetting is 3 from the table above)
Step 2. From the previous step, we get "Number of bits used for subnetting"(n) and know "Tb", then you can get "Number of bytes left for host"(m) = Tb - n as the total bytes is the sum of the number of bytes used for subnetting and the number of bytes remaining for the host, i.e. Tb = m+n.
-
Number of bytes left for host = m = Tb - n = 8 - 3 = 5
Step 3. Now calculate "Number of subnets" = 2 and "Last byte value used for subnet mask"(Δ) = 2m.
Number of hosts per subnet = 2m - 2.
-
Number of subnets = 2 = 23 = 8
Value of last bit used for subnet mask = = 2m = 25 = 32
Step 4. Now you can find the previously calculated number of subnets by dividing the subnets each having "Last byte value used for subnet mask" or address
- The 8 subnets (as calculated in the previous step) are shown above.
- Each has 32 addresses.
Step 5. Now find your IP address in which subnet, the first address of the subnet is the network address and the last address is the broadcast address
-
In this case, the fetched IP address is 210.1.1.100. 210.1.1.100 consists of 210.1.1.96 – subnet 210.1.1.127 (see table in the previous step). So, 210.1.1.96 is the network address and 210.1.1.127 is the broadcast address for the fetched IP address, which is 210.1.1.100.
Method 2 of 2: For CIDR
Step 1. In CIDR, you have an IP address followed by a byte-length prefix separated by a slash (/)
Now convert the byte-length prefix to a four-dotted decimal representation. To do this, follow these steps.
-
Write the byte prefix in the following format.
- If the value is 27, then write it as 8 + 8 + 8 + 3.
- If the value is 12, then write it as 8 + 4 + 0 + 0.
- The default value is 32, which is written as 8 + 8 + 8 + 8.
-
Change the corresponding bytes according to the table below and express them in four-point decimal format.
- Assume the IP address is 170.1.0.0/26. Using the table above, you can write:
- The subnet masks are 0, 128, 192, 224, 240, 248, 252, 254, and 255.
-
The table below states "Number of bytes used for subnetting"(n) on the corresponding subnet mask.
- For subnet mask 255 is the default value. So, it doesn't need to be taken into account for subnet masks.
-
From the previous step, obtained IP address = 170.1.0.0 and subnet mask = 255.255.255.192
Total bytes = Tb = 8 Number of bytes used for subnetting = n = 2 (since subnet mask = 192 and the corresponding "Number of bits used for subnetting" is 2 from the above table)
-
Number of subnets = 2 = 22 = 4
Value of last bit used for subnet mask = = 2m = 26 = 64
-
The 4 subnets (as calculated in the previous step) are
-
Each has 64 addresses.
-
In this case, the fetched IP address is 170.1.0.0; 170.1.0.0 consists of 170.1.0.0 – a subnet of 170.1.0.63 (see table in the previous step). So 170.1.0.0 is the network address and 170.1.0.63 is the broadcast address for the fetched IP address, which is 170.1.0.0.
-
IP address = 100.5.150.34 and subnet mask = 255.255.240.0
Total bytes = Tb = 8
Subnet mask 0 128 192 224 240 248 252 254 255 Number of bits used for subnetting (n) 0 1 2 3 4 5 6 7 8 Number of bytes used for subnetting for subnet mask 240 = n1 = 4
(since the subnet mask = 240 and the corresponding "Number of bits used for subnetting" is 4 from the table above)
Number of bytes used for subnetting for subnet mask 0 = n2 = 0
(since subnet mask = 0 and the corresponding "Number of bits used for subnetting" is 0 from the table above)
Number of bytes remaining for hosts for subnet mask 240 = m1 = Tb - n1 = 8 - 4 = 4
Number of bytes remaining for hosts for subnet mask 0 = m2 = Tb - n2 = 8 - 0 = 8
Number of subnets for subnet mask 240 = 2 1 = 24 = 16
Number of subnets for subnet mask 0 = 2 2 = 20 = 1
The value of the last bit used in the creation of a subnet mask for a subnet mask of 240 =1 = 2m1 = 24 = 16
The value of the last bit used in the creation of a subnet mask for a subnet mask 0 =2 = 2m2 = 28 = 256
For a subnet mask of 240, the address will be divided by 16 and for a subnet mask of 0, it will be divided by 256. Using the value of1 and2, 16 subnets are listed 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 consists of 100.5.144.0 - 100.5.159.255 and therefore 100.5.144.0 is the network address and 100.5.159.255 is the broadcast address
- IP address in CIDR = 200.222.5.100/9
- In CIDR, you can follow classy networking procedures right after you convert the byte-length prefix to a four-point decimal format.
- This method only applies to IPv4, does not apply to IPv6.
26 | = | 8 | + | 8 | + | 8 | + | 2 | ||||||||||
255 | . | 255 | . | 255 | . | 192 |
Now the IP address is 170.1.0.0 and the subnet mask in four-dot decimal format is 255.255.255.192.
Step 2. Total bytes = Tb = 8.
Step 3. From the previous step, we get "Number of bits used for subnetting"(n) and know "Tb", then you can get "Number of bytes left for host"(m) = Tb - n as the total bytes is the sum of the number of bits used for subnetting and the number of bytes remaining for the host, i.e. Tb = m+n.
Number of bytes left for host = m = Tb - n = 8 - 2 = 6
Step 4. Now calculate "Number of subnets" = 2 and "Last byte value used for subnet mask"(Δ) = 2m.
Number of hosts per subnet = 2m - 2.
Step 5. Now you can find the previously calculated number of subnets by dividing the subnets each having "Last byte value used for subnet mask" or address
Step 6. Now find out which subnet your IP address is in, the first address of the subnet is the network address and the last address is the broadcast address
Example
For Classy Network
For CIDR
9 | = | 8 | + | 1 | + | 0 | + | 0 | ||||||||||
255 | . | 128 | . | 0 | . | 0 |
IP address = 200.222.5.100 and subnet mask = 255.128.0.0
Total bytes = Tb = 8
Subnet mask | 0 | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
Number of bits used for subnetting (n) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Number of bytes used for subnetting for subnet mask 128 = n1 = 1
(since the subnet mask = 128 and the corresponding "Number of bits used for subnetting" is 1 from the table above)
Number of bytes used for subnetting for subnet mask 0 = n2 = n3 = 0
(since subnet mask = 0 and the corresponding "Number of bits used for subnetting" is 0 from the table above)
Number of bytes remaining for hosts for subnet mask 128 = m1 = Tb - n1 = 8 - 1 = 7
Number of bytes remaining for hosts for subnet mask 0 = m2 = m3 = Tb - n2 = Tb - n3 = 8 - 0 = 8
Number of subnets for subnet mask 128 = 2 1 = 21 = 2
Number of subnets for subnet mask 0 = 2 2 = 2 3 = 20 = 1
The value of the last bit used in the creation of a subnet mask for a subnet mask of 128 =1 = 2m1 = 27 = 128
Number of hosts per subnet = 2m1 - 2 = 27 - 2 = 126
The value of the last bit used in the creation of a subnet mask for a subnet mask 0 =2 =3 = 2m2 = 2m3 = 28 = 256
Number of hosts per subnet for subnet mask 0 = 2m2 - 2 = 2m3 - 2 = 28 - 2 = 254
For a subnet mask of 128, the address will be divided by 128 and for a subnet mask of 0, it will be divided by 256. Using the value of1,2 and3, 2 subnets are listed below
200.0.0.0 - 200.127.255.255 | 200.128.0.0 - 200.255.255.255 |