IP Subnetting Step #4: Determining Subnet Identifiers and Subnet Addresses
(Page 4 of 5)
Using Subnet Address Formulas to Calculate Subnet Addresses
Since the subnet addresses form a pattern, and the pattern depends on the number of subnet ID bits, it is possible to express the subnet addresses using a single formula for each subnetting option. I have shown these formulas for each of Classes A, B and C in the subnetting summary tables. The formulas can be used to directly calculate the address of subnet #N, where N is numbered from 0 up to one less than the total number of subnets, as we have done above.
In these formulas, the network ID bits are shown as x., or x.y. or x.y.z. for the three classes. This just means that the subnet addresses have as those octets whatever the numbers are in those octets for the network address. In our examples, x.y would be 166.113 for our Class B network, and x.y.z would be 211.77.20 for our Class C.
When the number of subnet bits is 8 or less, the formula is relatively simple, and a calculation is done for only one octet, as a multiplication of N, such as N*4 or N*32. This is usually the case, since the number of subnets is usually less than 256, and it's the case with both of our examples.
In our Class C network with 3 subnet ID bits, the formula from the table is x.y.z.N*32. For this network, all subnets are of the form 211.77.20.N*32, with N going from 0 to 7. So, subnet #5 is 211.77.20.(5*32), which is 188.8.131.52, as we saw before. Similarly, in our Class B network with 5 subnet ID bits, the formula is x.y.N*8.0. In this case x.y is 166.113. Subnet #26 would have the address 166.113.(26*8).0, or 184.108.40.206.
This is pretty simple stuff, and make the formulas a good short-cut for quickly determining subnet addresses, especially when there are many subnets. They can also be used in a spreadsheet. The only place that using the formulas requires a bit of care is when the number of subnet bits is 9 or more. This means the subnet identifier crosses an octet boundary, and this causes the formula to becomes more complex. So consider the rest of this topic optional, and skip it if you don't want to complicate your brain. J
Home - Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.