Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 36 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
36
Dung lượng
2,18 MB
Nội dung
C H A P T E R 5 Fundamentals of IP Addressing and Routing The OSI physical layer (Layer 1) defines how to transmit bits over a particular type of physical network. The OSI data link layer (Layer 2) defines the framing, addressing, error detection, and rules for when to use the physical medium. Although they are important, these two layers do not define how to deliver data between devices that exist far from each other, with many different physical networks sitting between the two computers. This chapter explains the function and purpose of the OSI network layer (Layer 3): the end-to-end delivery of data between two computers. Regardless of the type of physical network to which each endpoint computer is attached, and regardless of the types of physical networks used between the two computers, the network layer defines how to forward, or route, data between the two computers. This chapter covers the basics of how the network layer routes data packets from one computer to another. After reviewing the full story at a basic level, this chapter examines in more detail the network layer of TCP/IP, including IP addressing (which enables efficient routing), IP routing (the forwarding process itself), IP routing protocols (the process by which routers learn routes), and several other small but important features of the network layer. “Do I Know This Already?” Quiz The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these 13 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 5-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those sections. This helps you assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. 1828xbook.fm Page 93 Thursday, July 26, 2007 3:10 PM 94 Chapter 5: Fundamentals of IP Addressing and Routing 1. Which of the following are functions of OSI Layer 3 protocols? a. Logical addressing b. Physical addressing c. Path selection d. Arbitration e. Error recovery 2. Imagine that PC1 needs to send some data to PC2, and PC1 and PC2 are separated by several routers. What are the largest entities that make it from PC1 to PC2? a. Frame b. Segment c. Packet d. L5 PDU e. L3 PDU f. L1 PDU 3. Imagine a network with two routers that are connected with a point-to-point HDLC serial link. Each router has an Ethernet, with PC1 sharing the Ethernet with Router1, and PC2 sharing the Ethernet with Router2. When PC1 sends data to PC2, which of the following is true? a. Router1 strips the Ethernet header and trailer off the frame received from PC1, never to be used again. b. Router1 encapsulates the Ethernet frame inside an HDLC header and sends the frame to Router2, which extracts the Ethernet frame for forwarding to PC2. Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping Foundation Topics Section Questions Overview of Network Layer Functions 1 – 3 IP Addressing 4 – 8 IP Routing 9, 10 IP Routing Protocols 11 Network Layer Utilities 12, 13 1828xbook.fm Page 94 Thursday, July 26, 2007 3:10 PM “Do I Know This Already?” Quiz 95 c. Router1 strips the Ethernet header and trailer off the frame received from PC1, which is exactly re-created by R2 before forwarding data to PC2. d. Router1 removes the Ethernet, IP, and TCP headers and rebuilds the appropriate headers before forwarding the packet to Router2. 4. Which of the following are valid Class C IP addresses that can be assigned to hosts? a. 1.1.1.1 b. 200.1.1.1 c. 128.128.128.128 d. 224.1.1.1 e. 223.223.223.255 5. What is the range of values for the first octet for Class A IP networks? a. 0 to 127 b. 0 to 126 c. 1 to 127 d. 1 to 126 e. 128 to 191 f. 128 to 192 6. PC1 and PC2 are on two different Ethernets that are separated by an IP router. PC1’s IP address is 10.1.1.1, and no subnetting is used. Which of the following addresses could be used for PC2? a. 10.1.1.2 b. 10.2.2.2 c. 10.200.200.1 d. 9.1.1.1 e. 225.1.1.1 f. 1.1.1.1 1828xbook.fm Page 95 Thursday, July 26, 2007 3:10 PM 96 Chapter 5: Fundamentals of IP Addressing and Routing 7. Each Class B network contains how many IP addresses that can be assigned to hosts? a. 16,777,214 b. 16,777,216 c. 65,536 d. 65,534 e. 65,532 f. 32,768 g. 32,766 8. Each Class C network contains how many IP addresses that can be assigned to hosts? a. 65,534 b. 65,532 c. 32,768 d. 32,766 e. 256 f. 254 9. Which of the following does a router normally use when making a decision about routing TCP/IP packets? a. Destination MAC address b. Source MAC address c. Destination IP address d. Source IP address e. Destination MAC and IP address 10. Which of the following are true about a LAN-connected TCP/IP host and its IP routing (forwarding) choices? a. The host always sends packets to its default gateway. b. The host sends packets to its default gateway if the destination IP address is in a different class of IP network than the host. c. The host sends packets to its default gateway if the destination IP address is in a different subnet than the host. d. The host sends packets to its default gateway if the destination IP address is in the same subnet as the host. 1828xbook.fm Page 96 Thursday, July 26, 2007 3:10 PM “Do I Know This Already?” Quiz 97 11. Which of the following are functions of a routing protocol? a. Advertising known routes to neighboring routers. b. Learning routes for subnets directly connected to the router. c. Learning routes, and putting those routes into the routing table, for routes adver- tised to the router by its neighboring routers. d. To forward IP packets based on a packet’s destination IP address. 12. Which of the following protocols allows a client PC to discover the IP address of another computer based on that other computer’s name? a. ARP b. RARP c. DNS d. DHCP 13. Which of the following protocols allows a client PC to request assignment of an IP address as well as learn its default gateway? a. ARP b. RARP c. DNS d. DHCP 1828xbook.fm Page 97 Thursday, July 26, 2007 3:10 PM 98 Chapter 5: Fundamentals of IP Addressing and Routing Foundation Topics OSI Layer 3-equivalent protocols define how packets can be delivered from the computer that creates the packet all the way to the computer that needs to receive the packet. To reach that goal, an OSI network layer protocol defines the following features: Routing: The process of forwarding packets (Layer 3 PDUs). Logical addressing: Addresses that can be used regardless of the type of physical networks used, providing each device (at least) one address. Logical addressing enables the routing process to identify a packet’s source and destination. Routing protocol: A protocol that aids routers by dynamically learning about the groups of addresses in the network, which in turn allows the routing (forwarding) process to work well. Other utilities: The network layer also relies on other utilities. For TCP/IP, these utilities include Domain Name System (DNS), Dynamic Host Configuration Protocol (DHCP), Address Resolution Protocol (ARP), and ping. This chapter begins with an overview of routing, logical addressing, and routing protocols. Following that, the text moves on to more details about the specifics of the TCP/IP network layer (called the internetwork layer in the TCP/IP model). In particular, the topics of IP addressing, routing, routing protocols, and network layer utilities are covered. Overview of Network Layer Functions A protocol that defines routing and logical addressing is considered to be a network layer, or Layer 3, protocol. OSI does define a unique Layer 3 protocol called Connectionless Network Services (CLNS), but, as usual with OSI protocols, you rarely see it in networks today. In the recent past, you might have seen many other network layer protocols, such as Internet Protocol (IP), Novell Internetwork Packet Exchange (IPX), or AppleTalk Datagram Delivery Protocol (DDP). Today, the only Layer 3 protocol that is used widely is the TCP/ IP network layer protocol—specifically, IP. The main job of IP is to route data (packets) from the source host to the destination host. Because a network might need to forward large numbers of packets, the IP routing process is very simple. IP does not require any overhead agreements or messages before sending a packet, making IP a connectionless protocol. IP tries to deliver each packet, but if a router or host’s IP process cannot deliver the packet, it is discarded—with no error recovery. The NOTE The term path selection sometimes is used to mean the same thing as routing protocol, sometimes is used to refer to the routing (forwarding) of packets, and sometimes is used for both functions. 1828xbook.fm Page 98 Thursday, July 26, 2007 3:10 PM Overview of Network Layer Functions 99 goal with IP is to deliver packets with as little per-packet work as possible, which allows for large packet volumes. Other protocols perform some of the other useful networking functions. For example, Transmission Control Protocol (TCP), which is described in detail in Chapter 6, “Fundamentals of TCP/IP Transport, Applications, and Security,” provides error recovery, resending lost data, but IP does not. IP routing relies on the structure and meaning of IP addresses, and IP addressing was designed with IP routing in mind. This first major section of this chapter begins by introducing IP routing, with some IP addressing concepts introduced along the way. Then, the text examines IP addressing fundamentals. Routing (Forwarding) Routing focuses on the end-to-end logic of forwarding data. Figure 5-1 shows a simple example of how routing works. The logic illustrated by the figure is relatively simple. For PC1 to send data to PC2, it must send something to router R1, which sends it to router R2, and then to router R3, and finally to PC2. However, the logic used by each device along the path varies slightly. Figure 5-1 Routing Logic: PC1 Sending to PC2 10.1.1.1 10.0.0.0 168.0.0.0 168.11.0.0 168.1.0.0 168.1.1.1 Destination Is in Another Group; Send to Nearby Router. My Route to that Group Is Out Serial Link. My Route to that Group Is Out Frame Relay. Send Directly to PC2 R1 R2 R3 PC1 PC2 1828xbook.fm Page 99 Thursday, July 26, 2007 3:10 PM 100 Chapter 5: Fundamentals of IP Addressing and Routing PC1’s Logic: Sending Data to a Nearby Router In this example, illustrated in Figure 5-1, PC1 has some data to send to PC2. Because PC2 is not on the same Ethernet as PC1, PC1 needs to send the packet to a router that is attached to the same Ethernet as PC1. The sender sends a data-link frame across the medium to the nearby router; this frame includes the packet in the data portion of the frame. That frame uses data link layer (Layer 2) addressing in the data-link header to ensure that the nearby router receives the frame. The main point here is that the computer that created the data does not know much about the network—just how to get the data to some nearby router. Using a post office analogy, it’s like knowing how to get to the local post office, but nothing more. Likewise, PC1 needs to know only how to get the packet to R1, not the rest of the path used to send the packet to PC2. R1 and R2’s Logic: Routing Data Across the Network R1 and R2 both use the same general process to route the packet. The routing table for any particular network layer protocol contains a list of network layer address groupings. Instead of a single entry in the routing table per individual destination network layer address, there is one routing table entry per group. The router compares the destination network layer address in the packet to the entries in the routing table and makes a match. This matching entry in the routing table tells this router where to forward the packet next. The words in the bubbles in Figure 5-1 point out this basic logic. The concept of network layer address grouping is similar to the U.S. zip code system. Everyone living in the same vicinity is in the same zip code, and the postal sorters just look for the zip codes, ignoring the rest of the address. Likewise, in Figure 5-1, everyone in this network whose IP address starts with 168.1 is on the Ethernet on which PC2 resides, so the routers can have just one routing table entry that means “all addresses that start with 168.1.” Any intervening routers repeat the same process: the router compares the packet’s destination network layer (Layer 3) address to the groups listed in its routing table, and the matched routing table entry tells this router where to forward the packet next. Eventually, the packet is delivered to the router connected to the network or subnet of the destination host (R3), as shown in Figure 5-1. R3’s Logic: Delivering Data to the End Destination The final router in the path, R3, uses almost the exact same logic as R1 and R2, but with one minor difference. R3 needs to forward the packet directly to PC2, not to some other router. On the surface, that difference seems insignificant. In the next section, when you read about how the network layer uses the data link layer, the significance of the difference will become obvious. 1828xbook.fm Page 100 Thursday, July 26, 2007 3:10 PM Overview of Network Layer Functions 101 Network Layer Interaction with the Data Link Layer When the network layer protocol is processing the packet, it decides to send the packet out the appropriate network interface. Before the actual bits can be placed onto that physical interface, the network layer must hand off the packet to the data link layer protocols, which, in turn, ask the physical layer to actually send the data. And as was described in Chapter 3, “Fundamentals of LANs,” the data link layer adds the appropriate header and trailer to the packet, creating a frame, before sending the frames over each physical network. The routing process forwards the packet, and only the packet, end-to-end through the network, discarding data-link headers and trailers along the way. The network layer processes deliver the packet end-to-end, using successive data-link headers and trailers just to get the packet to the next router or host in the path. Each successive data link layer just gets the packet from one device to the next. Figure 5-2 points out the key encapsulation logic on each device, using the same examples as in Figure 5-1. Figure 5-2 Network Layer and Data Link Layer Encapsulation 10.1.1.1 10.0.0.0 168.10.0.0 168.11.0.0 168.1.0.0 Encapsulate IP Packet in Ethernet Extract IP Packet and Encapsulate in HDLC Extract IP Packet, and Encapsulate in Frame Relay Extract IP Packet, and Encapsulate in Ethernet Eth. IP Packet HDLC IP Packet FR IP Packet Eth IP Packet PC1 R1 R2 R3 168.1.1.1 PC2 1828xbook.fm Page 101 Thursday, July 26, 2007 3:10 PM 102 Chapter 5: Fundamentals of IP Addressing and Routing Because the routers build new data-link headers and trailers (trailers not shown in the figure), and because the new headers contain data-link addresses, the PCs and routers must have some way to decide what data-link addresses to use. An example of how the router determines which data-link address to use is the IP Address Resolution Protocol (ARP). ARP is used to dynamically learn the data-link address of an IP host connected to a LAN. You will read more about ARP later in this chapter. Routing as covered so far has two main concepts: ■ The process of routing forwards Layer 3 packets, also called Layer 3 protocol data units (L3 PDU), based on the destination Layer 3 address in the packet. ■ The routing process uses the data link layer to encapsulate the Layer 3 packets into Layer 2 frames for transmission across each successive data link. IP Packets and the IP Header The IP packets encapsulated in the data-link frames shown in Figure 5-2 have an IP header, followed by additional headers and data. For reference, Figure 5-3 shows the fields inside the standard 20-byte IPv4 header, with no optional IP header fields, as is typically seen in most networks today. Figure 5-3 IPv4 Header Of the different fields inside the IPv4 header, this book, and the companion ICND2 Official Exam Certification Guide, ignore all the fields except the Time-To-Live (TTL) (covered in Chapter 15 in this book), protocol (Chapter 6 of the ICND2 book), and the source and destination IP address fields (scattered throughout most chapters). However, for reference, Table 5-2 briefly describes each field. Version Header Length DS Field Packet Length Identification Fragment Offset (13)Flags (3) Time to Live Protocol Header Checksum Source IP Address Destination IP Address 081624 31 1828xbook.fm Page 102 Thursday, July 26, 2007 3:10 PM [...]... Figure 5- 6 illustrates a more realistic example that uses basic subnetting Figure 5- 6 Using Subnets 150 . 150 .1.0 150 . 150 .2.0 Ray 150 . 150 .1.1 Fay 150 . 150 .1.2 Hannah 150 . 150 .2.1 A B Jessie 150 . 150 .2.2 Frame Relay 150 . 150 .5. 0 150 . 150 .6.0 C D 150 . 150 .4.0 Kris 150 . 150 .4.2 150 . 150 .3.0 Wendell 150 . 150 .4.1 Vinnie 150 . 150 .3.1 As in Figure 5- 5 , the design in Figure 5- 6 requires six groups Unlike Figure 5- 5 , this... Chapter 5: Fundamentals of IP Addressing and Routing Figure 5- 1 1 Router R1 Learning About Subnet 150 . 150 .4.0 150 . 150 .1.10 Default Router 150 . 150 .1.4 150 . 150 .1.11 PC1 PC11 150 . 150 .1.4 R1 Routing Table Subnet Out Interface Next Hop 150 . 150 .4.0 Serial0 D 150 . 150 .2.7 C R1 S0 R2 Routing Table Subnet 150 . 150 .4.0 150 . 150 .2.7 R2 B R3 Routing Table S1 Subnet 150 . 150 .3.1 150 . 150 .4.0 R3 E0 A 150 . 150 .4.0 PC2 150 . 150 .4.10... Router 150 . 150 .1.4 150 . 150 .1.11 PC1 PC11 A 150 . 150 .1.0 R1 Routing Table 150 . 150 .1.4 Subnet R1 Out Interface Next Hop IP Address 150 . 150 .4.0 Serial0 150 . 150 .2.7 S0 B 150 . 150 .2.0 150 . 150 .2.7 R2 Routing Table Subnet C Out Interface Next Hop IP Address 150 . 150 .4.0 R2 Serial1 150 . 150 .3.1 S1 150 . 150 .3.0 150 . 150 .3.1 R3 Routing Table R3 Subnet E0 150 . 150 .4.0 Out Interface Next Hop IP Address 150 . 150 .4.0 Ethernet0... sends a packet to 150 . 150 .1.11 (PC11’s IP address), PC1 sends the packet over the Ethernet to PC11—there’s no need to bother the router 1828xbook.fm Page 1 15 Thursday, July 26, 2007 3:10 PM IP Routing Figure 5- 9 Host Routing Alternatives 150 . 150 .1.10 150 . 150 .1.11 PC1 PC11 150 . 150 .1.0 150 . 150 .1.4 R1 S0 150 . 150 .2.0 150 . 150 .2.7 R2 S1 150 . 150 .3.0 150 . 150 .3.1 R3 E0 150 . 150 .4.0 PC2 150 . 150 .4.10 Alternatively,... subnetting implemented Figure 5- 5 shows such a network, without subnetting Figure 5- 5 Backdrop for Discussing Numbers of Different Networks/Subnetworks 150 .1.0.0 150 .2.0.0 Ray Hannah A B Fay Jessie Frame Relay 150 .5. 0.0 150 .6.0.0 C D 150 .4.0.0 Kris 150 .3.0.0 Wendell Vinnie The design in Figure 5- 5 requires six groups of IP addresses, each of which is a Class B network in this example The four LANs each... 1828xbook.fm Page 118 Thursday, July 26, 2007 3:10 PM 118 Chapter 5: Fundamentals of IP Addressing and Routing route for subnet 150 . 150 .4.0—which includes the address range 150 . 150 .4.0– 150 . 150 .4. 255 —and realizes that the packet’s destination address 150 . 150 .4.10 matches that route (Step 3) Finally, R2 sends the packet out interface serial1 to next-hop router 150 . 150 .3.1 (R3) after encapsulating the packet in a... to 191 128.0.0.0 to 191. 255 .0.0 214 (16,384) 216 – 2 ( 65, 534) C 192 to 223 192.0.0.0 to 223. 255 . 255 .0 221 (2,097, 152 ) 28 – 2 ( 254 ) *The Valid Network Numbers column shows actual network numbers Networks 0.0.0.0 (originally defined for use as a broadcast address) and 127.0.0.0 (still available for use as the loopback address) are reserved Memorizing the contents of Table 5- 5 should be one of the first... with the next-hop router typically being the neighbor from which the route was learned For example, Figure 5- 1 1 shows the same sample network as in Figures 5- 9 and 5- 1 0, but now with focus on how the three routers each learned about subnet 150 . 150 .4.0 Note that routing protocols do more work than is implied in the figure; this figure just focuses on how the routers learn about subnet 150 . 150 .4.0 Again,... packets 114 List Four-step process of how routers route (forward) packets 116 Figure 5- 1 0 Example of the IP routing process 117 Figure 5- 1 1 Example that shows generally how a routing protocol can cause routers to learn new routes 120 Figure 5- 1 3 Example that shows the purpose and process of DNS name resolution 122 Figure 5- 1 4 Example of the purpose and process of ARP 123 Paragraph The most important information... instance, why does 150 . 150 .1.10 (PC1) assume that 150 . 150 .4.10 (PC2) is not on the same Ethernet? Well, because 150 . 150 .4.0, PC2’s subnet, is different from 150 . 150 .1.0, which is PC1’s subnet Because IP addresses in different subnets must be separated by a router, PC1 needs to send the packet to a router—and it does Similarly, all three routers list a route to subnet 150 . 150 .4.0, which, in this example, includes . Relay 150 . 150 .5. 0 150 . 150 .1.0 150 . 150 .4.0 150 . 150 .6.0 150 . 150 .2.0 Ray 150 . 150 .1.1 Kris 150 . 150 .4.2 Wendell 150 . 150 .4.1 Fay 150 . 150 .1.2 Hannah 150 . 150 .2.1 Jessie 150 . 150 .2.2 AB C D 150 . 150 .3.0 Vinnie 150 . 150 .3.1 1828xbook.fm. subnetting. Figure 5- 6 illustrates a more realistic example that uses basic subnetting. Figure 5- 6 Using Subnets As in Figure 5- 5 , the design in Figure 5- 6 requires six groups. Unlike Figure 5- 5 , this. 150 . 150 .0.0 into six subnets. To perform subnetting, the third octet (in this example) is used to identify unique subnets of network 150 . 150 .0.0. Frame Relay 150 . 150 .5. 0 150 . 150 .1.0 150 . 150 .4.0 150 . 150 .6.0 150 . 150 .2.0 Ray 150 . 150 .1.1 Kris 150 . 150 .4.2 Wendell 150 . 150 .4.1 Fay 150 . 150 .1.2 Hannah 150 . 150 .2.1 Jessie 150 . 150 .2.2 AB C D 150 . 150 .3.0 Vinnie 150 . 150 .3.1 1828xbook.fm