Binary Algorithm for Deriving the Valid Subnets with Basic and Difficult Subnetting

This section details a binary algorithm you can use to derive the subnet numbers. With basic subnetting, you probably would not want to go through this much trouble. However, with difficult subnetting, the binary algorithm will be useful, at least until you become comfortable with the decimal algorithm. The following binary algorithm is valid for basic subnetting as well.

Step 1 Reserve space to record a series of 32-bit numbers, one over the other. Also leave space between each nibble and byte on each line for better readability.

Step 2 Write down the 8, 16, or 24 bits of the network part of the address, in binary, on each line.

Step 3 Write down binary 0s in the host field on each line. This should result in a long list of binary numbers, with the subnet bits unrecorded at this point.

Step 4 Write down all binary 0s in the subnet bit positions of the first number in the list. This is the first subnet number, in binary. This is also the zero subnet.

Step 5 Add binary 1 to the subnet field in the previous line, and record the result in the subnet field of the next line.

Step 6 Repeat Step 5 until the subnet field is all binary 1s. That is the last subnet number, which is also the broadcast subnet.

Step 7 Convert any of these 32-bit numbers back to decimal, 8 bits at a time. IGNORE THE BOUNDARIES BETWEEN THE SUBNET AND HOST FIELDS—do the conversion 8 bits at a time.

As usual, an example is better than a generic algorithm. First, a repeat of the 150.150.0.0, 255.255.255.0 example will be shown. Then network 150.150.0.0, with a different mask of 255.255.248.0, will be shown. Table 5-20 shows the first several iterations of 150.150.0.0, mask 255.255.255.0, but with a few of the intermediate subnet numbers not shown.

Table 5-20 Valid Subnet Numbers

Step 2 (only one line shown)

1001 0110

1001 0110

Step 3 (only one line shown)

1001 0110

1001 0110

0000 0000

Step 4

1001 0110

1001 0110

0000 0000

0000 0000

150.150.0.0

Step 5

1001 0110

1001 0110

0000 0001

0000 0000

150.150.1.0

Step 6

1001 0110

1001 0110

0000 0010

0000 0000

150.150.2.0

Step 6

1001 0110

1001 0110

0000 0011

0000 0000

150.150.3.0

Step 6

1001 0110

1001 0110

0000 0100

0000 0000

150.150.4.0

Step 6

1001 0110

1001 0110

0000 0101

0000 0000

150.150.5.0

Skipped a few for brevity

Step 6

1001 0110

1001 0110

1111 1111

0000 0000

150.150.255.0

As Table 5-20 shows, the same 256 subnet numbers are derived with the binary algorithm as with the decimal algorithm. The second example shows one not-so-obvious (at least in decimal) case with difficult subnetting (Table 5-21).

Table 5-21 Valid Subnet Numbers, 150.150.0.0, Mask 255.255.248.0

Step 2 (only one line shown)

1001 0110

1001 0110

Step 3 (only one line shown)

1001 0110

1001 0110

000

0000 0000

Step 4

1001 0110

1001 0110

0000 0000

0000 0000

150.150.0.0

Step 5

1001 0110

1001 0110

0000 1000

0000 0000

150.150.8.0

Step 6

1001 0110

1001 0110

0001 0000

0000 0000

150.150.16.0

Step 6

1001 0110

1001 0110

0001 1000

0000 0000

150.150.24.0

Step 6

1001 0110

1001 0110

0010 0000

0000 0000

150.150.32.0

Step 6

1001 0110

1001 0110

0010 1000

0000 0000

150.150.40.0

Skipped a few for brevity

Step 6

1001 0110

1001 0110

1111 1111

0000 0000

150.150.248.0

So, with 5 subnet bits, there should be 25 or 32 subnets, including the zero and broadcast subnets. Examining the third octet of the decimal subnet numbers, with a little imagination, the 32 subnet numbers are 150.150.x.0, where x is an integer multiple of 8. The zero subnet is 150.150.0.0, and 150.150.248.0 is the broadcast subnet.

0 0

Post a comment