Wednesday, December 15, 2010

IPv4 Address Subnets Best Cisco CCNA Training institute in New Delhi

Network Bulls
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.

Table 7-11. IPv4 Default Network Address Masks
Class Binary Mask Dotted-Decimal Mask
A 11111111 00000000 00000000 00000000 255.0.0.0
B 11111111 11111111 00000000 00000000 255.255.0.0
C 11111111 11111111 11111111 00000000 255.255.255.0

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.

Table 7-12. Subnet Masks
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.

Table 7-13. Subnets for Network 195.1.1.0
LAN Fourth Byte Subnet Number First Host Broadcast Address
LAN 0 00000000 195.10.1.0 195.10.1.1 195.10.1.31
LAN 1 00100000 195.10.1.32 195.10.1.33 195.10.1.63
LAN 2 01000000 195.10.1.64 195.10.1.65 195.10.1.95
LAN 3 01100000 195.10.1.96 195.10.1.97 195.10.1.127
LAN 4 10000000 195.10.1.128 195.10.1.129 195.10.1.159
LAN 5 10100000 195.10.1.160 195.10.1.161 195.10.1.191
LAN 6 11000000 195.10.1.192 195.10.1.193 195.10.1.223
LAN 7 11100000 195.10.1.224 195.10.1.225 195.10.1.255

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.

Table 7-14. The AND Logical Operation
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.

Table 7-15. Subnetwork of IP Address 150.85.1.70
  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.

Table 7-16. Subnets with the /20 Mask
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.

Table 7-17. Subnetworks for 130.20.64.0/20
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.

Table 7-18. Serial-Link Subnetworks
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.

Table 7-19. Addresses Within Subnetwork 110.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.

Table 7-20. IP Address Allocation for VoIP Networks
Building Floor/Function VLAN Number IP Subnet
First-floor data VLAN 11 172.16.1.0/24
Second-floor data VLAN 12 172.16.2.0/24
Third-floor data VLAN 13 172.16.3.0/24
First-floor VoIP VLAN 14 172.16.4.0/24
Second-floor VoIP VLAN 15 172.16.5.0/24
Third-floor VoIP VLAN 16 172.16.6.0/24

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.

Table 7-21. Common Bits Within Class C Networks
Binary Address IP Address
11001000 00000001 01100100 00000000 200.1.100.0
11001000 00000001 01100101 00000000 200.1.101.0
11001000 00000001 01100110 00000000 200.1.102.0
11001000 00000001 01100111 00000000 200.1.103.0

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.

Table 7-22. Summarization of Networks
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

1 comment:

  1. This website is very helpful for the students who need info about the Mobile/Laptop Repairing courses.
    Chiptroniks 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.

    ReplyDelete