## Decimal Algorithm for Deriving the Valid Subnets with Basic Subnetting

Time counts when taking the CCNA exam, so it's a good idea to take advantage of the easier decimal algorithms to derive facts about subnetting. The algorithm for deriving the subnet numbers of a network, given a static, basic mask, is extremely intuitive. Two cases for the decimal algorithm will be examined here: a Class A network subnetted using mask 255.255.0.0, and a Class B network subnetted using mask 255.255.255.0:

Step 1 Write down the 1 or 2 bytes of the network number.

Step 2 Leave a space immediately to the right to add a value in the next octet.

Step 3 Write down two octets (in the case of Class A) or one octet (in the case of Class B) of 0 after the one-octet space left in Step 2, leaving a number with three octets written and an open space in the subnet part of the number.

Step 4 Write down a 1 in the open octet.

Step 5 Repeat Steps 1 through 4, but in Step 4 add 1 to the number. Continue repeating these steps until you reach 254.

A similar algorithm is used when a Class A network is subnetted, using mask 255.255.255.0, although that is not shown here.

The number of valid subnets is an important concept when deriving the actual subnet numbers. How many should you expect to find? The formula is very straightforward, with a few twists on the real answer. First, the formula:

### 2number-of-subnet-bits

The previous example in Figure 5-23 provides a good context in which to consider the formula. A Class B network 150.150.0.0 is used, so there are 16 network bits. The mask is 255.255.255.0, so there are 8 host bits. That leaves 8 subnet bits—28 = 256, for 256 subnets. From the previous example, 150.150.0.0 is the first subnet, and 150.150.255.0 was the last, which is consistent with the formula.

Two previously reserved cases, 150.150.0.0 and 150.150.255.0, were not used in the example. The first of these, which is called the zero subnet because the subnet value is all binary 0s, is usable only if the ip subnet-zero global command is configured. The other subnet, called the broadcast subnet because it looks like a typical broadcast address, is usable without any special configuration.

NOTE Do not confuse the zero subnet and broadcast subnet with the two reserved IP addresses in each subnet. There are still two reserved addresses in each subnet that cannot be assigned to any interface as an IP address. Those two numbers are the numbers used for the subnet number itself and the broadcast address for the subnet.

0 0