Subnetting
Subnetting allows the network or IP address administrator to maximize the use of an IP address space within the network. A subnet mask borrows bits from an IP address's host portion and uses the bits to define new networks. If subnetting is implemented, IP addresses have three sections:
► Host Address
Note: All IP addresses have a mask associated with them, either implied (default) or defined. There are three address representations: dotted decimal, bitcount, and hexadecimal.
The subnet or network defines the arbitrary segmentation performed by the network administrator. The subnet allows the creation of a hierarchical routing network.
A subnet mask is a 32-bit decimal number that is used to identify a network and its host addresses. Subnet masks can be the classful kind, as shown earlier in Table 5.1.
Class A, B, and C network addressing schemes are not much use in today's complex Internetworks unless you extend the mask or use variable length subnetting to avoid wasting IP address space. The phrase variable length subnetmask (VLSM) refers to the fact one network can be configured with different subnet masks. For example, a network could be configured to have one mask that allows only two hosts and another mask that can be extended to allow 512 hosts. VLSM ensures that IP addressing is not wasted. Think of a serial line that contains two routers. Why assign a Class C address for two nodes? Instead, you could assign an address (subnet) that contains only two hosts; the mask 255.255.255.252 can be used to accomplish this.
To determine the number of hosts or subnets available on a network, you need to examine the IP addresses in binary. To determine the number of hosts or subnets you can assign to a network, you apply the formula 2n-2, where n equals the number of borrowed bits. Why are two subnets subtracted? Because one address is reserved to identify the subnet and the other is used to send broadcasts (bits that are set to all 0s or all 1s are used for broadcasts). Determining how many hosts or subnets you can assign to a network is best explained with examples.
Let's assume the subnet mask 255.255.255.240 has been applied to your network. How many subnets are available when assigning the subnet address of 131.108.1.0?
Looking at the subnet mask, you can interpret the 240 as 11110000 in binary. Hence, 4 bits have been borrowed from the host portion of the IP address to form a subnet. Therefore, the subnet mask formula would be 24-2, which equates to 14 subnets (2*2*2*2=16-2=14). Why do we take away 2 subnets? The reason is that they are used to represent the subnet and the broadcast address. Bits that are set to all 0s are the network (wire address) and all 1s are used for broadcasts. This can be shown in the following:
131.108.1.0 255.255.255.240
In this subnet and subnet mask, note that:
|
► |
Network address 131.108.1.0 |
||
|
► |
First usable host address |
131.108.1 |
1 |
|
► |
Last usable host address |
131.108.1 |
,14 |
|
► |
131.108.1 |
,15 |
|
|
► |
Broadcast address 255.255.255.255 |
||
Similarly, consider the mask 255.255.255.192. How many end nodes could reside on the network? Note that 192 in binary is 11000000. Hence, two bits have been borrowed, so the end nodes can use the last six bits. The formula would be 26-2, which equates to 62 hosts.
Note: When using a 26-bit subnet mask, you need to use the ip subnet command to access all of the subnets that the mask allows!
It is vital that you have a good understanding of how an IP address' network and host portion is calculated. You should be able to calculate the number of hosts on a network using any IP addressing scheme.
For additional review, let's look at a couple more examples of how to calculate the host and subnet portion of any given class of address.
Given the host address of 131.108.1.93/24, what is the subnet and broadcast address?
You need to know what a network address such as 131.108.1.0/24 means. In this example, the address is the equivalent of the network 131.108.1.0 with a subnet mask of 255.255.255.0, or 24 bits of subnetting.
The notation 131.108.1.93/24 means that the subnet mask uses 24 bits, or the equivalent of a subnet mask represented as 255.255.255.0 in dotted format. Therefore, 131.108.1.93/24 is the same as 131.108.1.93 255.255.255.0. In binary, 131.108.1.93 is:
10000011.01101100.00000001.01011101
And the mask, 255.255.255.0 in binary is:
11111111.11111111.11111111.00000000
Performing a logical AND operation on the host address and subnet mask will provide you with the subnet mask, which has been derived as 255.255.255.0, or a Class C address. To determine the subnet, you must perform a logical AND function on the host. Logical AND means that 1 and 1 equates to 1 only. The remaining options are 0 AND 0 is 0, 0 AND 1 is 0. The logical AND operation provides the following:
10000011.01101100.00000001.01011101 IP ADDRESS 11111111.11111111.11111111.00000000 Subnet Mask EQUALS NETWORK 10000011.01101100.0000001.0000000
ALERT
ALERT
10000011.01101100.0000001.0000000 is a 131.108.1.0 subnet address. To determine the broadcast address, you need the decimal equivalent of all one bits (11111111), which is 255; hence, the broadcast address of a 131.108.1.0 subnet is 131.108.1.255.
Finally, let's look at a Class A host address of 10.99.34.50. Using a Class C mask, what is the network portion and how many hosts can reside on this network?
The logical AND function is performed once more. A Class C mask is 255.255.255.0 when represented in decimal format. Therefore, 10.99.34.50 and 255.255.255.0 in binary is
00001010.01100011.00100010.00110010 11111111.11111111.11111111.00000000
A logical AND between the address and mask yields:
00001010.01100011.00100010.00000000
00001010.01100011.00100010.00000000 indicates a subnet of 10.99.34.0. The number of hosts available on a Class C mask is 28-2, or 254 hosts, because 2 addresses are used to identify the subnet and the directed broadcast address. A directed broadcast address is sent to all hosts on the subnet only. (10.99.34.0 is the subnet and 10.99.34.255 is a directed broadcast address for all users on the local subnet.)
Table 5.2 provides a useful guide that can help you to prepare for the exam. Table 5.2 displays the decimal value and binary value of a subnet number followed by the number of available subnets. The number of hosts that can reside on each subnet follows.
Note: Try some subnet examples on your own and then compare them to a subnet calculator freely available on the Internet. Cisco's Web site (www.cisco.com/ techtools/ip_addr.html) has a subnet calculator.
|
Decimal |
Subnets |
Hosts |
|
252 (11111100) |
64 subnets |
2 hosts |
|
248 (11111000) |
32 subnets |
6 hosts |
|
240 (11110000) |
14 hosts |
|
|
224 (11100000) |
30 hosts |
|
|
192 (11000000) |
4 subnets |
62 hosts |
|
128 (10000000) |
2 subnets |
126 hosts |
Now that we've covered the IP addressing and the formats that are used to represent IP addresses, let's move on to a more advanced IP routing concept—Classless Interdomain Routing (CIDR).
Continue reading here: ARP and RARP
Was this article helpful?