Working with Subnets

The subnet mask defines how many bits after the network ID will be used for the subnet ID. The subnet ID can vary in length, depending on the value you select for the subnet mask. As the subnet ID grows larger, fewer bits are left for the host ID. In other words, if your network has many subnets, you will be limited to fewer hosts on each subnet. If you have only a few subnets and require only a few bits for the subnet ID, you can place more hosts on a subnet.

By the Way

Note that the address class also defines how many bits will be available for the subnet ID. The mask

 11111111111111111110000000000000 

specifies 19 bits for the network ID and subnet ID together. If this mask is used with a Class B address (which has a 16-bit network ID), only three bits are available for subnetting. The same mask is used with a Class A address (which has an 8-bit network ID); 11 bits are available for subnetting.


The assignment of subnet IDs (and hence the assignment of a subnet mask) depends on your network configuration. The best solution is to plan your network first and determine the number and location of all network segments, then assign each segment a subnet ID. You'll need enough subnet bits to assign a unique subnet ID to each subnet. Save room, if possible, for additional subnet IDs in case your network expands.

A simple example of subnetting is a Class B network in which the third octet (the third term in the dotted decimal IP address) is reserved for the subnet number. In Figure 5.6, the network 129.100.0.0 is divided into four subnets. The IP addresses on the network are given the subnet mask 255.255.255.0, signifying that the network ID and subnet mask span three octets of the IP address. Because the address is a Class B address (see Hour 4), the first two octets in the address form the network ID. Subnet A in Figure 5.6 therefore has the following parameters:

Figure 5.6. A subnetted Class B network.

graphics/05fig06.gif

Network ID: 129.100.0.0

Subnet ID: 0.0.128.0

Host IDs of either all ones or all zeros cannot be assigned. The configuration shown in Figure 5.6 therefore supports a possible 254 subnets and 254 addresses per subnet. This is a very sensible solution as long as you don't have more than 254 addresses on a subnet and as long as you have access to a Class B network address (which are getting harder to find).

It often isn't possible to assign a full octet to the subnet ID. On a Class C network, for instance, if you assigned a full octet to the subnet ID, you wouldn't have any bits left for the host ID. Even on a Class B network, you might not be able to use a full octet for the subnet ID, because you might need to make room for more than 254 hosts on a subnet. The subnetting rules do not require you to place the subnet ID at an octet boundary. The concept of a subnet ID that doesn't fall on an octet boundary is easy to visualize in binary form but becomes a bit more confusing when you return to dotted decimal format.

Consider a Class C network that must be divided into five small subnets. The class addressing rules provide 8 bits after the network ID to use for the subnet ID and the host ID in a Class C network. You could designate three of those bits for the subnet ID using this subnet mask:

 11111111111111111111111111100000 

The remaining five bits are then available for the host ID. The three bits of the subnet ID provide eight possible bit patterns. As mentioned earlier, the official subnetting rules exclude the all-ones pattern and the all-zeros pattern from the pool of subnet IDs (although many routers actually support the assignment of the all-ones or all-zeros subnet ID). In any case, this configuration is sufficient for five small subnets. The five bit places of the host ID offer 32 possible bit combinations. Excluding the all-zeros pattern and the all-ones pattern, the subnets could each hold 30 hosts.

To express this subnet mask in dotted decimal notation, follow the procedure described in the preceding section:

  1. Add periods to mark the octet boundaries:

     11111111.11111111.11111111.11100000 
  2. Write down 255 for each all-ones octet. Convert the mixed octet to decimal:

    128+64+32=224

  3. The dotted decimal version of this subnet mask is 255.255.255.224

Suppose you start placing hosts on this subnetted network (see Figure 5.7). Because this network is a Class C network, the first three octets will be the same for all hosts. To obtain the fourth octet of the IP address, simply write down the binary subnet ID and host ID in their respective bit positions. In Figure 5.7, for instance, the subnet ID field for Subnet C has the bit pattern 011. Because this pattern is on the left end of the octet, the bit positions of the subnet ID actually represent the pattern 01100000, which means that the subnet number is 96. If the host ID is 17 (binary 10001), the fourth octet is 01110001, which converts to 113. The IP address of this host is therefore 212.114.32.113.

Figure 5.7. A subnetted Class C network.

graphics/05fig07.gif

Table 5.1 shows the binary pattern equivalents of the dotted notation subnet masks. This table shows all valid subnet mask patterns. The Description column in Table 5.1 tells how many additional one bits are present beyond the one bits present in the default mask provided by the class designation. These mask bits are available for the subnet ID. For example, the default Class A mask has eight one bits; the row that displays two mask bits means there are eight plus two, or a total of 10 ones bits present in the subnet mask.

Table 5.1. Subnet Mask Dotted Notation to Binary Pattern

Description

Dotted Notation

Binary Pattern

Class A

Default Mask

255.0.0.0

11111111 00000000 00000000 00000000

1 subnet bit

255.128.0.0

11111111 10000000 00000000 00000000

2 subnet bits

255.192.0.0

11111111 11000000 00000000 00000000

3 subnet bits

255.224.0.0

11111111 11100000 00000000 00000000

4 subnet bits

255.240.0.0

11111111 11110000 00000000 00000000

5 subnet bits

255.248.0.0

11111111 11111000 00000000 00000000

6 subnet bits

255.252.0.0

11111111 11111100 00000000 00000000

7 subnet bits

255.254.0.0

11111111 11111110 00000000 00000000

8 subnet bits

255.255.0.0

11111111 11111111 00000000 00000000

9 subnet bits

255.255.128.0

11111111 11111111 10000000 00000000

10 subnet bits

255.255.192.0

11111111 11111111 11000000 00000000

11 subnet bits

255.255.224.0

11111111 11111111 11100000 00000000

12 subnet bits

255.255.240.0

11111111 11111111 11110000 00000000

13 subnet bits

255.255.248 0

11111111 11111111 11111000 00000000

14 subnet bits

255.255.252.0

11111111 11111111 11111100 00000000

15 subnet bits

255.255.254.0

11111111 11111111 11111110 00000000

16 subnet bits

255.255.255.0

11111111 11111111 11111111 00000000

17 subnet bits

255.255.255.128

11111111 11111111 11111111 10000000

18 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

19 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

20 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

21 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

22 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

Class B

Default Mask

255.255.0.0

11111111 11111111 00000000 00000000

1 subnet bit

255.255.128.0

11111111 11111111 10000000 00000000

2 subnet bits

255.255.192.0

11111111 11111111 11000000 00000000

3 subnet bits

255.255.224.0

11111111 11111111 11100000 00000000

4 subnet bits

255.255.240.0

11111111 11111111 11110000 00000000

5 subnet bits

255.255.248.0

11111111 11111111 11111000 00000000

6 subnet bits

255.255.252.0

11111111 11111111 11111100 00000000

7 subnet bits

255.255.254.0

11111111 11111111 11111110 00000000

8 subnet bits

255.255.255.0

11111111 11111111 11111111 00000000

9 subnet bits

255.255.255.128

11111111 11111111 11111111 10000000

10 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

11 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

12 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

13 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

14 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

Class C

Default subnet mask

255.255.255.0

11111111 11111111 11111111 00000000

1 subnet bit

255.255.255.128

11111111 11111111 11111111 10000000

2 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

3 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

4 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

5 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

6 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

By the Way

Some of the patterns in Table 5.1 are not very practical, and are included for illustration purposes only. For instance, a Class C network with six subnet bits has only two bits left for assigning host IDs. Of those two bits, the all-ones address (11) is reserved for broadcast, and the all-zeros address (00) is typically not used. This subnet therefore only has room for two hosts.




Sams Teach Yourself TCP/IP in 24 Hours
Sams Teach Yourself TCP/IP in 24 Hours (4th Edition)
ISBN: 0672329964
EAN: 2147483647
Year: 2003
Pages: 259
Authors: Joe Casad

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net