Tải bản đầy đủ (.pdf) (10 trang)

CCNA 1 and 2 Companion Guide, Revised (Cisco Networking Academy Program) part 50 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (229.96 KB, 10 trang )

The Mechanics of Subnetting 459
To determine the number of bits to be used, the network designer needs to calculate
how many hosts the largest subnetwork requires and the number of subnetworks. For
example, assume that this requirement is 30 hosts and five subnetworks. To calculate
how many bits to reassign, consult the Usable Hosts row in Table 8-4. For example,
for 30 usable hosts, 3 bits are required. This also creates six usable subnetworks, which
satisfies the requirements of this scheme. Again, the difference between usable and total
hosts is a result of using the first available address as the ID and the last available
address as the broadcast for each subnetwork. Classful routing does not provide the
capability to use these subnetworks, whereas classless routing recovers many of these
“lost” addresses, as shown in Table 8-4. This table illustrates the loss of subnets and
hosts when you don’t use a classless routing protocol.
Table 8-3 Subnetting Chart: Subnet Mask Identifier (Two Formats)
Slash Format
/25 /26 /27 /28 /29 /30 — —
Mask
128 192 224 240 248 252 254 255
Bit
12345678
Value
1286432168421
Table 8-4 Subnetting Chart: Subnets and Hosts
Slash Format
/25 /26 /27 /28 /29 /30 — —
Mask
128 192 224 240 248 252 254 255
Bit
12345678
Value
1286432168421
Total Subnets


4 8 163264
Usable Subnets
2 6 143062
Total Hosts
64 32 16 8 4
Usable Hosts
62 30 14 6 2
1102.book Page 459 Tuesday, May 20, 2003 2:53 PM
460 Chapter 8: Routing Fundamentals and Subnets
An alternative way to compute the subnet mask and the number of networks is to use
the following formulae:
The number of usable subnets equals 2 to the power of the assigned subnet bits
minus 2:
(2
power of bits assigned
) – 2 = usable subnets
For example, 2
3
– 2 = 6
The number of usable hosts equals 2 to the power of the bits remaining minus 2:
(2
power of bits remaining
) – 2 = usable hosts
For example, 2
5
– 2 = 30
Creating a Subnet
To create subnets, you must extend the routing portion of the address. The Internet
“knows” your network as a whole, identified by the Class A, B, or C address, which
defines 8, 16, or 24 routing bits (the network number). The subnet field represents

additional routing bits so that the routers within your organization can recognize dif-
ferent locations, or subnets, within the whole network.
Subnet masks use the same format as IP addresses. In other words, each subnet mask
is 32 bits long and is divided into four octets. Subnet masks have all 1s in the network
and subnetwork portion and all 0s in the host portion. By default, if no bits are bor-
rowed, the subnet mask for a Class B network is 255.255.0.0. However, if 8 bits were
borrowed, the subnet mask for the same Class B network would be 255.255.255.0,
as shown in Figures 8-32 and 8-33. However, because there are two octets in the host
field of a Class B network, up to 14 bits can be borrowed to create subnetworks. A
Class C network has only one octet in the host field. Therefore, only up to 6 bits can
be borrowed in Class C networks to create subnetworks.
The subnet field always immediately follows the network number. That is, the borrowed
bits must be the first n bits of the default host field, where n is the desired size of the new
subnet field, as shown in Figure 8-34. The subnet mask is the tool used by the router to
determine which bits are routing bits and which bits are host bits.
Determining Subnet Mask Size
Again, subnet masks contain all 1s in the network bit positions (determined by the
address class) as well as the subnet bit positions, and they contain all 0s in the remain-
ing bit positions, designating them as the host portion of an address.
1102.book Page 460 Tuesday, May 20, 2003 2:53 PM
The Mechanics of Subnetting 461
Figure 8-32 Network and Host Addresses
Figure 8-33 Binary Conversion Chart
Figure 8-34 Subnetting a Class B Address
IP
Address
172 16
Network
00
Host

Default
Subnet
Mask
255 255
Network
00
Host
8-Bit
Subnet
Mask
255 255
Network
255 0
HostSubnet
Use Host Bits, Starting at the
High-Order Bit Position
128 64 32 16 8 4 2 1
10 00 0000=128
11 00 0000=192
11 10 0000=224
11 11 0000=240
11 11 1000=248
11 11 1100=252
11 11 1110=254
11 11 1111=255
1102.book Page 461 Tuesday, May 20, 2003 2:53 PM
462 Chapter 8: Routing Fundamentals and Subnets
By default, if you borrow no bits, the subnet mask for a Class B network would be
255.255.0.0, which is the dotted-decimal equivalent of 1s in the 16 bits corresponding
to the Class B network number and 0s in the other 16 bits.

If 8 bits were borrowed for the subnet field, the subnet mask would include 8 additional
1 bits and would become 255.255.255.0. For example, if the subnet mask 255.255.255.0
were associated with the Class B address 130.5.2.144 (8 bits borrowed for subnetting),
the router would know to route this packet to subnet 130.5.2.0 rather than just to net-
work 130.5.0.0, as shown in Figure 8-35.
Figure 8-35 Subnet Masking: Class B Address
Another example is the Class C address 197.15.22.131 with a subnet mask of
255.255.255.224. With a value of 224 in the final octet (11100000 in binary), the
24-bit Class C network portion has been extended by 3 bits to make the total 27 bits. The
131 in the last octet presents the third usable host address in the subnet 197.15.22.128, as
shown in Figure 8-36. The routers in the Internet (that don’t know the subnet mask)
only worry about routing to the Class C network 197.15.22.0. The routers inside that
network, knowing the subnet mask, look at 27 bits to make a routing decision.
Figure 8-36 Subnet Masking: Class C Address
Computing the Subnet Mask and IP Address
Whenever you borrow bits from the host field, it is important to note the number of
additional subnets that are being created each time you borrow one more bit. You have
already learned that you cannot borrow only 1 bit; the fewest you can borrow is 2.
Borrowing 2 bits creates four possible subnets (2 × 2) (but you must remember that
there are two reserved/unusable subnets). Each time you borrow another bit from the
Network Field
Subnetwork
Field
Host
Field
11000101 00001111 00010110 10000011
1102.book Page 462 Tuesday, May 20, 2003 2:53 PM
The Mechanics of Subnetting 463
host field, the number of subnets created increases by a power of 2. Eight possible sub-
nets are created by borrowing 3 bits (2 × 2 × 2). Sixteen possible subnets are created by

borrowing 4 bits (2 × 2 × 2 × 2). From these examples and from the binary conversion
chart that was shown in Figure 8-33, it is easy to see that each time you borrow another
bit from the host field, the number of possible subnets doubles.
Computing Hosts Per Subnetwork
Each time you borrow 1 bit from a host field, there is 1 less bit remaining that can be
used for host numbers. Specifically, each time you borrow another bit from the host
field, the number of host addresses that you can assign decreases by a power of 2 (gets
cut in half).
To understand how this works, consider a Class C network address. If there is no sub-
net mask, all 8 bits in the last octet are used for the host field. Therefore, 256 (2
8
)
possible addresses are available to assign to hosts (254 usable addresses after you
subtract the two you know you can’t use). Now, imagine that this Class C network
is divided into subnets. If you borrow 2 bits from the default 8-bit host field, the host
field decreases in size to 6 bits. If you wrote out all the possible combinations of 0s and
1s that could occur in the remaining 6 bits, you would discover that the total number
of possible hosts that could be assigned in each subnet would be reduced to 64 (2
6
).
The number of usable host numbers would be reduced to 62.
In the same Class C network, if you borrow 3 bits, the size of the host field decreases
to 5 bits, and the total number of hosts you can assign to each subnet is reduced to
32 (2
5
). The number of usable host numbers decreases to 30.
The number of possible host addresses that can be assigned to a subnet is related to
the number of subnets that have been created. In a Class C network, for example, if
a subnet mask of 255.255.255.224 has been applied, 3 bits (224 in decimal equals
11100000 in binary) are borrowed from the host field. Six usable subnets are created

(8 – 2), each having 30 (32 – 2) usable host addresses.
Calculating the Resident Subnetwork Through ANDing
As mentioned earlier, the network or subnet address has all 0s in the host portion. To
route a data packet, the router must first determine the destination network/subnet
address. To accomplish this, the router performs a logical AND using the destination
host’s IP address and the subnet mask for that network.
1102.book Page 463 Tuesday, May 20, 2003 2:53 PM
464 Chapter 8: Routing Fundamentals and Subnets
Imagine that you have a Class B network with the network number 172.16.0.0. After
assessing your network’s needs, you decide to borrow 8 bits to create subnets. As you
learned earlier, when you borrow 8 bits with a Class B network, the subnet mask is
255.255.255.0, as shown in Figure 8-37.
Figure 8-37 8 Bits of Subnetting
Someone outside the network sends data to the IP address 172.16.2.120. To determine
where to deliver the data, the router ANDs this address with the subnet mask.
When the two numbers are ANDed, the host portion of the result is always 0. What
is left is the network number, including the subnet. Thus, the data is sent to subnet
172.16.2.0, and only the final router notices that the packet should be delivered to
host 120 in that subnet.
Now, imagine that you have the same network, 172.16.0.0. This time, however, you
decide to borrow only 7 bits for the subnet field. The binary subnet mask for this is
11111111.11111111.11111110.00000000. What is this in dotted-decimal notation?
Again, someone outside the network sends data to host 172.16.2.120. To determine
where to send the data, the router again ANDs this address with the subnet mask. As
before, when the two numbers are ANDed, the host portion of the result is 0. So what
is different in this second example? Everything looks the same—at least, in decimal.
The difference is in the number of subnets available and the number of hosts available
per subnet. You can see this only by comparing the two different subnet masks, as
shown in Figure 8-38.
Figure 8-38 Network Number Extended by 7 Bits

1102.book Page 464 Tuesday, May 20, 2003 2:53 PM
Summary 465
With 7 bits in the subnet field, there can be only 126 subnets. How many hosts can
there be in each subnet? How long is the host field? With 9 bits for host numbers, there
can be 510 hosts in each of those 126 subnets.
Summary
In this chapter, you learned the following key points:
■ The differences between, mechanics of, and characteristics of routing and routed
protocols.
Lab Activity Basic Subnetting
This exercise provides a basic overview of the subnetting and the ANDing
processes. Given a network address and requirements, you determine the sub-
net mask, the number of subnets and hosts per subnet, and the number of
usable subnets and hosts. You also use the ANDing process to determine if a
destination IP address is local or remote. Finally, you identify valid and invalid
IP host addresses based on a given a network number and subnet mask.
Lab Activity Subnetting a Class A Network
In this exercise, you analyze a Class A network address with the number of
network bits specified to determine the subnet mask, number of subnets, hosts
per subnet, and information about specific subnets.
Lab Activity Subnetting a Class B Network
In this exercise, you analyze a Class B network address with the number of net-
work bits specified to determine the subnet mask, number of subnets, hosts per
subnet, and information about specific subnets.
Lab Activity Subnetting a Class C Network
In this exercise, you analyze a Class C network address with the number of
network bits specified to determine the subnet mask, number of subnets, hosts
per subnet, and information about specific subnets.
1102.book Page 465 Tuesday, May 20, 2003 2:53 PM
466 Chapter 8: Routing Fundamentals and Subnets

■ To provide extra flexibility for the network administrator, networks—particu-
larly large ones—are often divided into smaller networks called subnetworks or
subnets. Subnetting allows a network administrator to get around the limitations
of availability of IP addresses by dividing a single network address into many
subnets visible only within that single network.
■ The function of a subnet mask is to tell devices which part of an address is the
network number, including the subnet, and which part is the host.
■ Internetworking functions of the network layer include network addressing and
best-path selection for data traffic.
■ How to explain IP addressing, IP address classes, reserved IP address space,
private IP address space, and IP subnetting.
To supplement all that you’ve learned in this chapter, refer to the chapter-specific Videos,
PhotoZooms, and e-Lab Activities on the CD-ROM accompanying this book.
1102.book Page 466 Tuesday, May 20, 2003 2:53 PM
Key Terms 467
Key Terms
algorithm A well-defined rule or process for arriving at a solution to a problem. In
networking, algorithms are commonly used to determine the best route for traffic from
a particular source to a particular destination.
autonomous system A network or set of networks that are under the administrative
control of a single entity, such as the Cisco.com domain.
broadcast A data packet that is sent to all nodes on a network. Broadcasts are identi-
fied by a broadcast address.
broadcast domain A set of all devices that receive broadcast frames originating from
any device within the set. Broadcast domains are typically bounded by routers (or, in a
switched network, by VLANs) because routers do not forward broadcast frames.
classless interdomain routing (CIDR) A technique supported by BGP and based on
route aggregation. CIDR allows routers to group routes to cut down on the quantity
of routing information carried by the core routers. With CIDR, several IP networks
appear to networks outside the group as a single, larger entity.

collision domain In Ethernet, the network area within which frames that have collided
are propagated. Repeaters and hubs propagate collisions; LAN switches, bridges, and
routers do not.
connectionless Data transfer without the existence of a virtual circuit.
connection-oriented Data transfer that requires the establishment of a virtual circuit.
datagram A logical grouping of information sent as a network layer unit over a
transmission medium without prior establishment of a virtual circuit. IP datagrams are
the primary information units in the Internet. The terms cell, frame, message, packet,
and segment also describe logical information groupings at various layers of the OSI
reference model and in various technology circles.
distance-vector routing A class of routing algorithms that iterate on the number of
hops in a route to find a shortest-path spanning tree. Distance-vector routing algorithms
call for each router to send its entire routing table in each update, but only to its
neighbors. Distance-vector routing algorithms can be prone to routing loops but are
computationally simpler than link-state routing algorithms. Also called the Bellman-
Ford routing algorithm.
Exterior Gateway Protocol (EGP) An Internet protocol used to exchange routing
information between autonomous systems. Border Gateway Protocol (BGP) is the
most common EGP.
1102.book Page 467 Tuesday, May 20, 2003 2:53 PM
468 Chapter 8: Routing Fundamentals and Subnets
hop The passage of a data packet from one network node, typically a router, to
another.
hop count A routing metric used to measure the distance between a source and a
destination. RIP uses hop count as its sole metric.
Interior Gateway Protocol (IGP) An Internet protocol used to exchange routing
information within an autonomous system. Examples of common Internet IGPs are
IGRP, OSPF, and RIP.
Interior Gateway Routing Protocol (IGRP) An IGP developed by Cisco to address
the problems associated with routing in large, heterogeneous networks.

IP address A 32-bit address assigned to hosts using TCP/IP. An IP address belongs
to one of five classes (A, B, C, D, or E) and is written as four octets separated by periods
(that is, dotted-decimal format). Each address consists of a network number, an optional
subnetwork number, and a host number. The network and subnetwork numbers
together are used for routing, and the host number is used to address an individual
host within the network or subnetwork. A subnet mask is used to extract network and
subnetwork information from the IP address. CIDR provides a new way to represent
IP addresses and subnet masks. Also called an Internet address.
MAC address A standardized data link layer address that is required for every device
that connects to a LAN. Other devices in the network use these addresses to locate
specific devices in the network and to create and update routing tables and data struc-
tures. MAC addresses are 6 bytes long and are controlled by the IEEE. Also called a
hardware address, MAC-layer address, or physical address.
NetBIOS Extended User Interface (NetBEUI) An enhanced version of the NetBIOS
protocol used by network operating systems such as LAN Manager, LAN Server,
Windows for Workgroups, and Windows NT. NetBEUI formalizes the transport frame
and adds functions. NetBEUI implements the OSI LLC2 protocol.
octet 8 bits. In networking, the term octet is often used (rather than byte) because
some machine architectures employ bytes that are not 8 bits long.
packet A logical grouping of information that includes a header containing control
information and (usually) user data. Packets most often refer to network-layer units of
data. The terms datagram, frame, message, and segment also describe logical informa-
tion groupings at various layers of the OSI reference model and in various technology
circles.
1102.book Page 468 Tuesday, May 20, 2003 2:53 PM

×