TCP/IP Subnetting: Creating the 8-bit Subnetting Table for Class A, B, and C Networks

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Archived content - No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Editor's Note This article was written by TechNet subscriber Phil Calderone. It explains how to derive the 8-bit subnet tables found on page 95 of the Microsoft Official Curriculum course "Internetworking with Microsoft TCP/IP on Windows NT 4.0" without having to use a scientific calculator. For more in-depth, comprehensive information about subnetting, we highly recommend Introduction to TCP/IP https://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/cnet/corenetwork.asp.

If you have ever taken a TCP/IP or IIS class, you know how difficult building your first subnet table was. First you had to have a scientific calculator. Then you had to do the "2 to the power of 2" thing, plus all the binary-to-decimal equations. Then you had to list all possible bit combinations for the subnet mask, and then convert them to decimal format to determine the beginning value of each subnet.

Well, here's an easier way. Throw away your scientific calculator.

If you have any knowledge of the table, or at least have built one, you will immediately understand the benefits of this method. However, if you have never built a table before, you should find this pretty straightforward.

You will have to remember a few numbers; the more you remember, the easier it will be. We must remember that the default subnet mask is 255, and the highest number of subnets we can have in the first valid subnet mask is 2. We need to remember that in the Class C host, the last two subnets are invalid. Last, we need to know that there are 4 octets of 8 bits each, and the decimal equivalent for the 8 bits is 128-64-32-16-8-4-2-1. We will use simple math -- multiplication, addition, and subtraction -- to build our table. First, let's do some review.

Example of a Subnet Mask

11111111

11111111

11111111

11111111

Binary

255

255

255

255

Decimal

1st octet

2nd octet

3rd octet

4th octet

Octets

4 octets separated by periods, each octet with 8 binary numbers.

An octet breaks down like this: 11111111. To convert it to a decimal, you must work from right to left, so the first number in the octet from the right is equal to 1, the second is 2, the third is 4, the fourth is 8, the fifth is 16, the sixth is 32, the seventh is 64, and the eighth, the one on the far left, is 128. So you will have 128-64-32-16-8-4-2-1 as the decimal equivalent to an octet. If you were to add all these numbers together, they would equal 255.

To begin, get two sheets of paper, including one for practice. (I recommend that you do not use a calculator. It will really help you to do the math on your scratch paper.) After you try this method a couple of times, one piece of paper will suffice.

Set up 6 columns with 8 rows (example below).

Beginning Range of Network IDs for Subnets

Subnet mask

# of Subnets

# of hosts per subnet Class - C

# of hosts per subnet Class - B

# of hosts per subnet Class - A

128--Invalid

Invalid

Invalid

Invalid

Invalid

Invalid

64

 

2

 

 

 

32

 

 

 

 

 

16

 

 

 

 

 

8

 

 

 

 

 

4

 

 

 

 

 

2

 

 

Invalid

 

 

1

.255

 

Invalid

 

 

  • Row 1 in all columns is invalid, so mark it out.

  • Take one octet's decimal numbers, 128-64-32-16-8-4-2-1, and place them in the first column from high to low. This will now be our beginning range of network IDs for the subnets.

  • Take the highest subnet mask number (.255) and place it at the bottom of the subnet mask column.

  • Take the first subnet value, 2, and place it in our first valid subnet location.

  • In the Class C column, rows 7 and 8 are invalid. Mark them as such.

We're finished with the hard part; the rest is simple math.

Let's begin with the first two columns. To figure the subnet mask, take the number from the range column (column 1), and subtract it from the number in the subnet mask column (column 2). Place the answer in the next row above, and continue until all rows in the subnet mask column are filled.

Example:

255

1= 254, 254

2=252, 252

4= 248, 248

8=240, 240

16= 224, 224

32= 192

Beginning Range of Network IDs for Subnets

Subnet mask

Math from above Example

128-- Invalid

Invalid

 

64

.192

 

32

.224

224 – 32 = 192

16

.240

240 – 16 = 224

8

.248

248 - 8 = 240

4

.252

252 - 4 = 248

2

.254

254 - 2 = 252

1

.255

255 - 1 = 254 carry up

You have just figured out your subnet mask.

Now let's work with column 3, the number of subnets per subnet mask. From our chart, we know that we have 2 subnets next to subnet mask (.192), so that's where we start. Take the number of subnets times 2, plus 2, and put that answer in the next row down under subnets. Continue until all rows are filled.

Example:

2x2=4+2=6

6x2=12+2=14

14x2=28+2=30

30x2=60+2=62

62x2=124+2=126

126X2=252+2=254

# of Subnets

Math from above example

Invalid

Invalid

2

(2x2) +2 = 6 carry down

6

(6x2) +2 = 14

14

(14x2) +2 = 30

30

(30x2) +2 = 62

62

(62x2) +2 = 126

126

(126x2) +2 = 254

254

 

You have just figured out the number of subnets per subnet mask.

Your table should look like this.

Beginning Range of Network IDs for Subnets

Subnets Mask

# of Subnets

# of hosts per subnet Class - C

# of hosts per subnet Class - B

# of hosts per subnet Class - A

128 -- Invalid

Invalid

Invalid

Invalid

Invalid

Invalid

64

.192

2

 

 

 

32

.224

6

 

 

 

16

.240

14

 

 

 

8

.248

30

 

 

 

4

.252

62

 

 

 

2

.254

126

Invalid

 

 

1

.255

254

Invalid

 

 

Now we know the number of subnets we can have per subnet mask, and the starting range of that subnet.

For example, if I have a Class B address with anywhere from 7 to 14 subnets needed, I know I must use 255.255.240.0 as my subnet mask. I also know my range for subnets will begin at 16, and jump by 16's (see example).

Subnet

Beginning value

Ending value

Subnet 1

w.x.16.1

w.x.31.254

Subnet 2

w.x.32.1

w.x.47.254

Subnet 3

w.x.48.1

w.x.63.254

And so on. You would go by 16's until all 14 subnets are set up.

Subnet 14

w.x.224.1

w.x.239.254

To figure out the number of hosts per subnet for Class C addresses, take the number of subnets in column 3 on your table, and turn them upside down. List them in the valid areas of Class C. Start at the bottom-most valid area and go up.

Example:

# of hosts per subnet Class - C

Invalid

62

30

14

6

2

Invalid

Invalid

That's the number of hosts per subnet in Class C.

Now to go to Class B.

We take 62 (the highest number of hosts we can have in Class C) and multiply it by 4, (the total number of octets). Then add 6 (the total number of ranges open above the range we are figuring). This gives us the smallest number of hosts per subnet for a Class B address.

Example: 62 x 4 = 248 + 6 = 254, so 254 is the smallest number we can have in a Class B address.

Put that number at the bottom of your Class B Table. To move up the table from there, we will take that number times 2, and add 2 to get to the next range.

254 x 2 = 508 + 2 = 510

510 x 2 = 1020 + 2 = 1022
1022 x 2 = 2044 + 2 = 4094
4094 x 2 = 8188 + 2 = 8190
8190 x 2 = 16,380 + 2 = 16,382

# of hosts per subnet Class - B

Invalid

16,382

8190

4094

2046

1022

510

254

That's Class B hosts per subnet.

Now we move to Class A.

Take 16,382 x 4 + 6 = 65,534. This is the starting host for Class A, and we go back to the times-2-plus-2 formula.

# of hosts per subnet Class – A

Invalid

4,194,302

2,097,150

1,048,574

524,286

262,142

131,070

65,534

Now your subnet mask table should look like this.

Beginning Range of Network ID's for Subnets

Subnets Mask

# of Subnets

# of hosts per subnet Class - C

# of hosts per subnet Class - B

# of hosts per subnet Class - A

128 -- Invalid

Invalid

Invalid

Invalid

Invalid

Invalid

64

.192

2

62

16,382

4,194,302

32

.224

6

30

8,190

2,097,150

16

.240

14

14

4,094

1,048,574

8

.248

30

6

2,046

524,286

4

.252

62

2

1,022

262,142

2

.254

126

Invalid

510

131,070

1

.255

254

Invalid

254

65,534

In a nutshell:

Take one octet and list its decimal numbers down in order. Make the top row of each column invalid and make the bottom 2 rows of Class C column invalid. Insert .255 at the bottom of the subnet mask column. Insert 2 at the top of the number of subnets column at the first valid spot.

To figure out the subnet mask column, subtract the number in the range column from the number in the subnet mask column. This will give you the next subnet mask number. Then you subtract the number in the range column on its same line from that number to get the next subnet mask number, and so on.

To figure out the number of subnets, multiply the starting number (2) by 2 and add 2 to get the next subnet number. Then multiply that number by 2 and add 2 to get the next subnet number. And so on.

To get the number of hosts, invert the subnet table onto the Class C column starting at the bottom from low to high in the first valid location.

To jump to Class B, take the highest host number (62) from Class C and multiply it times 4 (the number of octets). Then add 6 (the number of open ranges above the number you're on): 62 x 4 = 248 + 6 = 254. Take that number and put it at the bottom of Class B, the smallest number of hosts. To move up the table in Class B, take the number times 2. Add 2 to get the next higher number, and so on until you reach the top.

To jump to Class A, take the highest number from Class B times 4 and add 6. This will give you the bottom of Class A: 16,382 x 4 = 65,528 + 6 = 65,534. Then multiply that number times 2, add 2 to move up the table, then the next number times 2, and add 2 for the next number, and so on.

Phil Calderone is a Network Administrator for Mid-West Forge in Cleveland Ohio. He is an MCP, MCP+I and MCSE. His email address is pcmcse@hotmail.com.

Do you have a tip you'd like to share? Send us your favorite ideas on troubleshooting, optimizing, saving time, or similar topics, and we'll share them with others right here. If your tip is selected technet/promo/tip.htm, we'll publish it with your byline and send you a free TechNet T-shirt.