Subnetting


For a given number of binary bits there will be a given number of combinations that can be achieved, note however that all 0’s or all 1's are not allowed.

Class A Networks

The first octet is used for the network with the first bit set to 0. Therefore these networks have:

Class A addresses are assigned to networks with a very large number of hosts. Class A networks use a default subnet mask of 255.0.0.0 and have 1-126 as their first octet. (The 127 Network is reserved for loopback)

Class B networks

The first and second octets are used for the network with the first 2 bits set to 10. Therefore these networks have:

Class B addresses are assigned to medium-sized to large-sized networks. Class B networks use a default subnet mask of 255.255.0.0 and have 128-191 as their first octet.

Class C networks

The first 3 octets are used for the network with the first 3 bits set to 110. Therefore these networks have:

Class C addresses are used for small LANs. Class C networks use a default subnet mask of 255.255.255.0 and have 192-223 as their first octet.

Subnetting

Sometimes a network will need to be subdivided into smaller segments, this is known as subnetting and is accomplished by adjusting the subnet mask from the default. There are various methods of calculating the number of networks and hosts you can get from a given network by subnetting it. Obviously the easiest ways involve using one of the subnet calculators that are available for download. It can be handy though to be able to quickly work this out simply by using a pen and paper. This may seem a little complicated at first, but just follow the instructions using a pen and paper, do it a couple of times and it becomes second nature.

Subnetting a Class C network
  1. Create a 8 x 4 table - this table represents the final Octet of the 4.
  2. Fill out the top row. Starting at the right column in the top row, working left, put the decimal equivalent of only that corresponding bit in an octet being set to 1
    i.e.;
    0000001 = 1
    0000010 = 2
    0000100 = 4 etc.

    This row represents the working number of the subnet.

  3. Fill out the second row. Add the leftmost 2 numbers from the top column, and enter into the second column of the second row. (128 + 64 = 192). In subsequent columns, add the number in the top row to the number to its immediate left (the number you just entered), i.e. for column 3, 32 + 192 = 224. Do not fill in the last 2 columns.
    This row represents the final octet of the subnet mask.
  4. Fill out the third row. Subtract 2 from the numbers in the top row. Enter only where you have entered numbers into row 2.
    This row represents the number of hosts available on each subnet.
  5. Fill out the bottom row. Reverse the sequence of host numbers
    This row represents the number of available subnets.
128 64 32 16 8 4 2 1
 
192
224 240 248 252 Subnet
mask
  62 30 14 6 2 Hosts
  2 6 14 30 62 Subnets

Example:

You have a class C network with the Network ID 203.12.16.0, you need 6 networks.

Look up the Subnets row on the table and you can see that for 6 Subnets, you will get up to 30 hosts per subnet by using a subnet mask of 255.255.255.224 (11111111 . 11111111 . 11111111 . 11100000). It can be seen that the 3 high-order bits on the final octet of the subnet mask give the 6 networks (see top of page for explanation of 3 bits giving 6 possible valid addresses).

To calculate the Network IDs and Host ID ranges

Address ranges are

Subnet Network ID Broadcast Host ID Range
INVALID
0 (000-00000)
Network ID all bits set to 0
1
32 (001-00000)
63 (001-111111)
203.12.16.33 - 203.12.16.62
2
64 (010-00000)
95 (010-111111)
203.12.16.65 - 203.12.16.94
3
96 (011-00000)
127 (011-111111)
203.12.16.97 - 203.12.16.126
4
128 (100-00000)
159 (100-11111)
203.12.16.129 - 203.12.16.158
5
160 (101-00000)
191 (101-11111)
203.12.16.161 - 203.12.16.190
6
192 (110-00000)
223 (110-11111)
203.12.16.191 - 203.12.16.222
INVALID
224 (111-00000)
Network ID all bits set to 1

That was simple right? So now you will see that using the same principles, you can just as easily subnet a Class B network.

Subnetting a Class B network
  1. Draw an 8x4 table as before, draw another one beside it. These tables represent the 3rd and 4th Octets.
    Note: The table below has been completed at this point, do not add the top row on the left table.
  2. Fill out the top row. In each table, starting at the right column in the top row, working left. Put the decimal equivalent of only that corresponding bit in an octet being set to 1
    i.e.;
    0000001 = 1
    0000010 = 2
    0000100 = 4 etc.

    These rows on both tables will represent the working number of the subnet.

  3. Fill out the second row. Starting with the table for the 3rd Octet work as before. Add the leftmost 2 numbers from the top column, and enter into the second column of the second row. (128 + 64 = 192). In subsequent columns, add the number in the top row to the number to its immediate left (the number you just entered), i.e. for column 3, 32 + 192 = 224. Unlike in the Class C subnet example above, work to the rightmost column. (Remember, as this is the 3rd Octet, its perfectly feasible to have this part of the subnet mask set to 255)
    This row represents the third octet of the subnet mask.
  4. When complete, fill out the subnet mask row on the table for the 4th Octet, this time starting in the leftmost column (as this is a class B network, it is OK to have a the final Octet of the subnet mask set to 128, in a class C network, this would leave you with no valid Network). Do not fill in the last 2 columns.
    This row represents the last octet of the subnet mask.
  5. Add an extra row to the top of the table for the 3rd Octet.
  6. Following the path of the red arrow, continue doubling from the top row of the 4th Octet, along the new top row of the 3rd Octet.
  7. Fill out the Hosts row on both tables. Subtract 2 from the numbers in the top row. Enter only where you have entered numbers into the Subnet Mask row.
    This row represents the number of hosts available on each subnet.
  8. Fill out the Subnets row on both tables. Reverse the sequence of host numbers.
    This row represents the number of available subnets.

    Note: Once the Hosts and Subnets rows are completed, the top row on the table for the 3rd Octet can be disregarded.
32768 16384 8192 4096 2048 1024 512 256
128 64 32 16 8 4 2 1
 
192
224 240 248 252 254 255
  16382 8190 4094 2046 1022 510 254
  2 6 14 30 62 126 254

3rd OCTET

128 64 32 16 8 4 2 1
128 192 224 240 248 252 Subnet
mask
126 62 30 14 6 2 Hosts
510 1022 2046 4094 8190 16382 Subnets

4th OCTET

Example:

You have a full class B network with the Network ID 142.211.0.0, you need it split into a minimum 120 networks.

Look up the Subnets row on the table and you can see that for 126 Subnets, you will get up to 510 hosts per subnet by using a subnet mask of 255.255.254.0 (11111111 . 11111111 . 11111110 . 00000000). The 7 high-order bits of the 3rd Octet of the subnet mask give the 126 networks [(27) - 2 = 126 possible networks]. The 9 remaining (zero) bits give us the 510 Hosts per network [(29) - 2 = 510 possible hosts].

To calculate the Network IDs and Host ID ranges

Address ranges are

Subnet Network ID Broadcast Host ID Range
INVALID
0.0
(0000000-0 . 00000000)
Network ID all bits set to 0
1
2.0
(0000001-0 . 00000000)
3.255
(0000001-1 . 11111111)
142.211.2.1 - 142.211.3.254
2
4.0
(0000010-0 . 00000000)
5.255
(0000010-1 . 11111111)
142.211.4.1 - 142.211.5.254
3
6.0
(0000011-0 . 00000000)
7.255
(0000011-1 . 11111111)
142.211.6.1 - 142.211.7.254
4
8.0
(0000100-0 . 00000000)
9.255
(0000100-1 . 11111111)
142.211.8.1 - 142.211.9.254
5
10.0
(0000101-0 . 00000000)
11.255
(0000101-1 . 11111111)
142.211.10.1 - 142.211.11.254
6
12.0
(0000110-0 . 00000000)
13.255
(0000110-1 . 11111111)
142.211.12.1 - 142.211.13.254
7
14.0
(0000111-0 . 00000000)
15.255
(0000111-1 . 11111111)
142.211.14.1 - 142.211.15.254
And so on until
126
252.0
(1111110-0 . 00000000)
253.255
(1111110-1 . 11111111)
142.211.252.1 - 142.211.253.254
INVALID
254.0
(1111111-0 . 00000000)
Network ID all bits set to 1

Look at the binary number for the Network part of the addresses on the above example, disregard all but the 7 high order bits. The address range starts at 0000001 and ends at 1111110 and it can be seen that the number is actually increasing by one with each network. So there is a contiguous range of 126 network numbers.

If you follow that logic and then take the 9 low order bits of the host portion of the address. The address range starts at 000000001 and ends at 111111110 for each network, so likewise there is a contiguous range on each network of 510 host numbers.

The same applies in the Class C network example above.

Using the Class B tables as a guide, a set of tables for subnetting a Class A network can be constructed. However, if you are lucky enough to be in the position of subnetting a Class A network, why are you reading this page?

Top of page


©2000 - 2010 ez-pc.org.
All rights reserved

Visitor Number 4126640
ez-pc Forum Site Map Subnetting
was last reviewed May 18, 2002