www.networkbulls.com
Best Institute for CCNA CCNP CCSP CCIP CCIE Training in India
M-44, Old Dlf, Sector-14 Gurgaon, Haryana, India
Call: +91-9654672192
Subnetting plays an important part in IPv4 addressing. The subnet mask helps determine the network, subnetwork, and host part of an IP address. The network architect uses subnetting to manipulate the default mask to create subnetworks for LAN and WAN segments. These subnetworks provide enough addresses for LANs of different sizes. Point-to-point WAN links usually get a subnet mask that allows for only two hosts because only two routers are present in the point-to-point WAN link. You should become familiar with determining subnetwork numbers, broadcast addresses, and host address ranges given an IP address and mask.
Subnet masks are used for Class A, B, and C addresses only. Multicast addresses do not use subnet masks. A subnet mask is a 32-bit number in which bits are set to 1 to establish the network portion of the address, and a 0 is the host part of the address. The mask's bits set to 1 are contiguous on the left portion of the mask; the bits set to 0 are contiguous on the right portion of the mask. Table 7-11 shows the default masks for Class A, B, and C addresses. This section addresses various ways to represent IP subnet masks. Understanding these ways is significant because the representation of a network and its mask can appear differently in Cisco documentation or on the command-line interface.
Mask Nomenclature
There are several ways to represent IP subnet masks. The mask can be binary, hexadecimal, dotted-decimal, or a prefix "bit mask." Historically, the most common representation was the dotted-decimal format (255.255.255.0). The prefix bit mask format is now more popular. This format represents the mask by using a slash followed by the number of leading address bits that must be set to 1 for the mask. For example, 255.255.0.0 is represented as /16. Table 7-12 shows most of the mask representations. The /30 mask is common for WAN point-to-point links, and /32 is used for router loopback addresses.
| Dotted Decimal | Bit Mask | Hexadecimal |
|---|---|---|
| 255.0.0.0 | /8 | FF000000 |
| 255.192.0.0 | /10 | FFC00000 |
| 255.255.0.0 | /16 | FFFF0000 |
| 255.255.224.0 | /19 | FFFFE000 |
| 255.255.240.0 | /20 | FFFFF000 |
| 255.255.255.0 | /24 | FFFFFF00 |
| 255.255.255.128 | /25 | FFFFFF80 |
| 255.255.255.192 | /26 | FFFFFFC0 |
| 255.255.255.224 | /27 | FFFFFFE0 |
| 255.255.255.240 | /28 | FFFFFFF0 |
| 255.255.255.248 | /29 | FFFFFFF8 |
| 255.255.255.252 | /30 | FFFFFFFC |
| 255.255.255.255 | /32 | FFFFFFFF |
IP Address Subnet Design Example
This example shows subnetting for a small company. Say the company has 200 hosts and is assigned the Class C network of 195.10.1.0/24. The 200 hosts are in six different LANs.
You can subnet the Class C network using a mask of 255.255.255.224. Looking at the mask in binary (11111111 11111111 11111111 11100000), the first three bytes are the network part, the first 3 bits of the fourth byte determine the subnets, and the five remaining 0 bits are for host addressing.
Table 7-13 shows the subnetworks created with a mask of 255.255.255.224. Using this mask, 2n subnets are created, where n is the number of bits taken from the host part for the subnet mask. This example uses 3 bits, so 23 = 8 subnets. With Cisco routers, you can use the all-1s subnet (LAN 7) for a subnet. You cannot use the 0s subnet by default, but with Cisco routers, you can use it by configuring the ip subnet-zero command. The first column of the table lists the LAN. The second column shows the binary of the fourth byte of the IP address. The third column shows the subnet number, and the fourth and fifth columns show the first host and broadcast address of the subnet.
Use the formula 2n – 2 to calculate the number of hosts per subnet, where n is the number of bits for the host portion. The preceding example has 5 bits in the fourth byte for host addresses. With n = 5, 25 – 2 = 30 hosts. For LAN 1, host addresses range from 195.10.1.33 to 195.10.1.62 (30 addresses). The broadcast address for the subnet is 195.10.1.63. Each LAN repeats this pattern with 30 hosts in each subnet.
The example uses a fixed-length subnet mask. The whole Class C network has the same subnet mask, 255.255.255.224. Routing protocols such as Routing Information Protocol version 1 (RIPv1) and Interior Gateway Routing Protocol (IGRP) can use only fixed-length subnet masks; they do not support VLSMs, in which masks of different lengths identify subnets within the network. VLSMs are covered later in this chapter.
Determining the Network Portion of an IP Address
Given an address and mask, you can determine the classful network, the subnetwork, and the subnetwork's broadcast number. You do so with a logical AND operation between the IP address and subnet mask. You obtain the broadcast address by taking the subnet number and making the host portion all 1s. Table 7-14 shows the logical AND operation. Notice that the AND operation is similar to multiplying bit 1 and bit 2; if any 0 is present, the result is 0.
| Bit 1 | Bit 2 | AND |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
As an example, take the IP address 150.85.1.70 with a subnet mask of 255.255.255.224, as shown in Table 7-15. Notice the 3 bold bits in the subnet mask. These bits extend the default Class C prefix (/24) 3 bits to a mask of /27. As shown in Table 7-15, you perform an AND operation of the IP address with the subnet mask to obtain the subnetwork. You obtain the broadcast number by making all the host bits 1. As shown in bold, the subnet mask reaches 3 bits in the fourth octet. The subnetwork is identified by the five rightmost zeros in the fourth octet, and the broadcast is identified by all ones in the five rightmost bits.
| Binary First, Second, and Third Octets | Binary Fourth Octet | Dotted-Decimal IP | ||
|---|---|---|---|---|
| IP Address | 10010110 01010101 00000001 | 010 | 00110 | 150.85.1.70 |
| Subnet Mask | 11111111 11111111 11111111 | 111 | 00000 | 255.255.255.224 |
| Subnetwork | 10010110 01010101 00000001 | 010 | 00000 | 150.85.1.64 |
| Major network portion | Subnet | Host | ||
| Broadcast Address | 10010110 01010101 00000001 | 010 | 11111 | 150.85.1.95 |
VLSMs
VLSMs are used to divide a network into subnets of various sizes to prevent wasting IP addresses. If a Class C network uses 255.255.255.240 as a subnet mask, 16 subnets are available, each with 14 IP addresses. If a point-to-point link needs only two IP addresses, 12 IP addresses are wasted. This problem scales further with Class B and Class A address space. With VLSMs, small LANs can use /28 subnets with 14 hosts, and larger LANs can use /23 or /22 masks with 510 and 1022 hosts, respectively. Point-to-point networks use a /30 mask, which supports two hosts.
VLSM Address-Assignment Example
Take Class B network 130.20.0.0/16 as an example. Using a /20 mask produces 16 subnetworks. Table 7-16 shows the subnetworks. With the /20 subnet mask, the first 4 bits of the third byte determine the subnets.
| Third Byte | Subnetwork |
|---|---|
| 00000000 | 130.20.0.0/20 |
| 00010000 | 130.20.16.0/20 |
| 00100000 | 130.20.32.0/20 |
| 00110000 | 130.20.48.0/20 |
| 01000000 | 130.20.64.0/20 |
| 01010000 | 130.20.80.0/20 |
| 01100000 | 130.20.96.0/20 |
| 01110000 | 130.20.112.0/20 |
| 10000000 | 130.20.128.0/20 |
| 10010000 | 130.20.144.0/20 |
| 10100000 | 130.20.160.0/20 |
| 10110000 | 130.20.176.0/20 |
| 11000000 | 130.20.192.0/20 |
| 11010000 | 130.20.208.0/20 |
| 11100000 | 130.20.224.0/20 |
| 11110000 | 130.20.240.0/20 |
With fixed-length subnet masks, the network would support only 16 networks. Any LAN or WAN link would have to use a /20 subnet. This scenario is a waste of address space and therefore is inefficient. With VLSMs, you can further subnet the /20 subnets.
For example, take 130.20.64.0/20 and subdivide it to support LANs with about 500 hosts. A /23 mask has 9 bits for hosts, producing 29 – 2 = 510 IP addresses for hosts. Table 7-17 shows the subnetworks for LANs within a specified subnet.
| Third Byte | Subnetwork |
|---|---|
| 01000000 | 130.20.64.0/23 |
| 01000010 | 130.20.66.0/23 |
| 01000100 | 130.20.68.0/23 |
| 01000110 | 130.20.70.0/23 |
| 01001000 | 130.20.72.0/23 |
| 01001010 | 130.20.74.0/23 |
| 01001100 | 130.20.76.0/23 |
| 01001110 | 130.20.78.0/23 |
With VLSMs, you can further subdivide these subnetworks of subnetworks. Take subnetwork 130.20.76.0/23 and use it for two LANs that have fewer than 250 hosts. It produces subnetworks 130.20.76.0/24 and 130.20.77.0/24. Also, subdivide 130.20.78.0/23 for serial links. Because each point-to-point serial link needs only two IP addresses, use a /30 mask. Table 7-18 shows the subnetworks produced.
| Third Byte | Fourth Byte | Subnetwork |
|---|---|---|
| 01001110 | 00000000 | 130.20.78.0/30 |
| 01001110 | 00000100 | 130.20.78.4/30 |
| 01001110 | 00001000 | 130.20.78.8/30 |
| 01001110 | 00001100 | 130.20.78.12/30 |
| . . . | . . . | . . . |
| 01001111 | 11110100 | 130.20.79.244/30 |
| 01001111 | 11111000 | 130.20.79.248/30 |
| 01001111 | 11111100 | 130.20.79.252/30 |
Each /30 subnetwork includes the subnetwork number, two IP addresses, and a broadcast address. Table 7-19 shows the bits for 130.20.78.8/30.
| Binary Address | IP Address | Function |
|---|---|---|
| 10000010 00010100 01001110 00001000 | 130.20.78.8 | Subnetwork |
| 10000010 00010100 01001110 00001001 | 130.20.78.9 | IP address 1 |
| 10000010 00010100 01001110 00001010 | 130.20.78.10 | IP address 2 |
| 10000010 00010100 01001110 00001011 | 130.20.78.11 | Broadcast address |
Loopback Addresses
You can also reserve a subnet for router loopback addresses. Loopback addresses provide an always-up interface to use for router-management connectivity. The loopback address can also serve as the router ID for some routing protocols. The loopback address is a single IP address with a 32-bit mask. In the previous example, network 130.20.75.0/24 could provide 255 loopback addresses for network devices starting with 130.20.75.1/32 and ending with 130.20.75.255/32.
IP Telephony Networks
You should reserve separate subnets for LANs using IP phones. IP phones are normally placed in an auxiliary VLAN that is in a logical segment separate from that of the user workstations. Separating voice and data on different subnets or VLANs also aids in providing QoS for voice traffic in regards to classifying, queuing, and buffering. This design rule also facilitates troubleshooting.
Table 7-20 shows an example of allocating IP addresses for a small network. Notice that separate VLANs are used for the VoIP devices.
CIDR and Summarization
CIDR permits the address aggregation of classful networks. It does so by using the common bits to join networks. The network addresses need to be contiguous and have a common bit boundary.
With CIDR, ISPs assign groups of Class C networks to enterprise customers. This arrangement eliminates the problem of assigning too large of a network (Class B) or assigning multiple Class C networks to a customer and having to maintain an entry for each Class C network in the routing tables. It reduces the size of the Internet routing tables and allows for more stable routing topology because the routers do not have the recomputed routing table when more specific routes cycle up and down.
You can summarize four contiguous Class C networks at the /22 bit level. For example, networks 200.1.100.0, 200.1.101.0, 200.1.102.0, and 200.1.103.0 share common bits, as shown in Table 7-21. The resulting network is 200.1.100.0/22, which you can use for a 1000-node network.
It is important for an Internet network designer to assign IP networks in a manner that permits summarization. It is preferred that a neighboring router receive one summarized route, rather than 8, 16, 32, or more routes, depending on the level of summarization. This setup reduces the size of the routing tables in the network.
For route summarization to work, the multiple IP addresses must share the same leftmost bits, and routers must base their routing decisions on the IP address and prefix length.
Figure 7-5 shows an example of route summarization. All the edge routers send network information to their upstream routers. Router E summarizes its two LAN networks by sending 192.168.16.0/23 to Router A. Router F summarizes its two LAN networks by sending 192.168.18.0/23. Router B summarizes the networks it receives from Routers C and D. Routers B, E, and F send their routes to Router A. Router A sends a single route (192.168.16.0/21) to its upstream router, instead of sending eight routes. This process reduces the number of networks that upstream routers need to include in routing updates.
Notice in Table 7-22 that all the Class C networks share a bit boundary with 21 common bits. The networks are different on the 22nd bit and thus cannot be summarized beyond the 21st bit. All these networks are summarized with 192.168.16.0/21.
| Binary Address | IP Network |
|---|---|
| 11000000 10101000 00010000 00000000 | 192.168.16.0 |
| 11000000 10101000 00010001 00000000 | 192.168.17.0 |
| 11000000 10101000 00010010 00000000 | 192.168.18.0 |
| 11000000 10101000 00010011 00000000 | 192.168.19.0 |
| 11000000 10101000 00010100 00000000 | 192.168.20.0 |
| 11000000 10101000 00010101 00000000 | 192.168.21.0 |
| 11000000 10101000 00010110 00000000 | 192.168.22.0 |
| 11000000 10101000 00010111 00000000 | 192.168.23.0 |
This website is very helpful for the students who need info about the Mobile/Laptop Repairing courses.
ReplyDeleteChiptroniks Offers the Laptop and Mobile Repairing Course By IIT Faculty. Are u searching India's best Hardware Networking course and CCNA Course Fully Course Institute And opportunity to learn all other electronics devices repairing Course.