Home > Articles > Cisco > CCNA Routing and Switching

  • Print
  • + Share This
This chapter is from the book

IP Routing and Routing Protocols

In the first section of this chapter, you read about the basics of routing using a network with three routers and two PCs. Armed with more knowledge of IP addressing, you now can take a closer look at the process of routing IP. Figure 5-13 repeats the familiar network diagram, this time with subnets of network 150.150.0.0 used.

Figure 13Figure 5-13 Simple Routing Example, with IP Subnets

First, a few detail about the figure need to be explained. The subnet numbers are shown, with the whole third octet used for the subnet part of the addresses. The actual IP addressed for PC1 and PC2 are shown. However, the full IP addresses of the routers are not shown in the figure. Many times, to reduce clutter, only the host part of the address is listed in a figure. For instance, R2's IP address on the serial link to R1 is 150.150.2.7. The subnet is 150.150.2.0, and the .7 shown beside R2 in the figure represents the host part of the address, which is the fourth octet in this case.

A detailed examination of the routing logic used by PC1, R1, R2, and R3 is listed earlier in this chapter. That same logic is repeated here, using the more detailed information contained in the figure:

Step 1

PC1 sends the packet to R1—PC1 first builds the IP packet, with a destination address of PC2's IP address (150.150.4.10). PC1 needs to send the packet to R1 because it knows that its default router is 150.150.1.4. PC1 first checks its ARP cache, hoping to find R1's Ethernet MAC address. If it is not found, PC1 ARPs to learn R1's Ethernet MAC address. Then PC1 places the IP packet into an Ethernet frame, with a destination Ethernet address of R1's Ethernet address. PC1 sends the frame onto the Ethernet.

Step 2

R1 processes the incoming frame and forwards the packet to R2— Because the incoming Ethernet frame has a destination MAC of R1's Ethernet MAC, R1 copies the frame off the Ethernet for processing. If the FCS passes, meaning that the Ethernet frame did not have any errors in it, R1 looks at the Protocol Type field to discover that the packet inside the frame is an IP packet. R1 then discards the Ethernet header and trailer.

 

Next, R1 looks for the routing table entry that matches the destination address in the packet, 150.150.4.10. The routing table entry is listed in the figure—a route to subnet 150.150.4.0, with outgoing interface Serial0 to next-hop router R2 (150.150.2.7).

 

Now R1 just needs to build an HDLC frame and send it out its Serial0 interface to R2. As mentioned earlier, ARP is not needed on a point-to-point HDLC WAN link. R1 knows all the information necessary to out the packet inside an HDLC frame and send the frame.

Step 3

R2 processes the incoming frame and forwards the packet to R3—R2 repeats the same general process as R1 when it receives the HDLC frame. After stripping the HDLC header and trailer, R2 also needs to find the routing table entry that matches destination 150.150.4.10. R2's routing table has an entry for 150.150.4.0, outgoing interface serial1, to next-hop router 150.150.3.1, which is R3.

 

Before R2 can complete the task, the correct DLCI for the VC to R3 must be decided. The details of how R2 knows the right DLCI are covered in Chapter 11, "Frame Relay," of the CCNA ICND Exam Certification Guide. With that mapping information, R2 can complete the Frame Relay header and send the frame to R3.

Step 4

R3 processes the incoming frame and forwards the packet to PC2—Like R1 and R2 before it, R3 checks the FCS in the data-link trailer, looks at the type field to decide whether the packet inside the frame is an IP packet, and then discards the Frame Relay header and trailer. The routing table entry for 150.150.4.0 shows that the outgoing interface is R3's Ethernet interface, but there is no next-hop router because R3 is connected directly to subnet 150.150.4.0. All R3 has to do is encapsulate the packet inside a Ethernet header and trailer, and forward the frame. Before R3 can finish building the Ethernet header, an IP ARP broadcast must be used to find PC2's MAC address (assuming that R3 doesn't already have that information in its IP ARP cache).


The routing process relies on the rules relating to IP addressing. For instance, why did 150.150.1.10 (PC1) assume that 150.150.4.10 (PC2) was not on the same Ethernet? Well, because 150.150.4.0, PC2's subnet, is different than 150.150.1.0, which is PC1's subnet. Because IP addresses in different subnets must be separated by some router, PC1 needed to send the packet to some router—and it did. Similarly, all three routers list a route to subnet 150.150.4.0, which, in this example, includes IP addresses 150.150.4.1 to 150.150.4.254. What if someone tried to put PC2 somewhere else in the network, but still using 150.150.4.10? The routers then would forward packets to the wrong place. So, Layer 3 routing relies on the structure of Layer 3 addressing to route more efficiently.

IP Routing Protocols

IP routing protocols fill the IP routing table with valid, (hopefully) loop-free routes. Each route includes a subnet number, the interface out which to forward packets so that they are delivered to that subnet, and the IP address of the next router that should receive packets destined for that subnet (if needed).

Before examining the underlying logic, you need to consider the goals of a routing protocol. The goals described in the following list are common for any IP routing protocol, regardless of its underlying logic type:

  • To dynamically learn and fill the routing table with a route to all subnets in the network.

  • If more than one route to a subnet is available, to place the best route in the routing table.

  • To notice when routes in the table are no longer valid, and to remove those routes from the routing table.

  • If a route is removed from the routing table and another route through another neighboring router is available, to add the route to the routing table. (Many people view this goal and the preceding one as a single goal.)

  • To add new routes, or to replace lost routes, with the best currently available route as quickly as possible. The time between losing the route and finding a working replacement route is called convergence time.

  • To prevent routing loops.

Routing protocols can become rather complicated, but the basic logic that they use is relatively simple. Routing protocols take the routes in a routing table and send a message to their neighbors telling them about the routes. After a while, everyone has heard about all the routes.

Figure 5-14 shows a sample network, with routing updates shown. Table 5-6 lists Router B's routing table before receiving the routing updates, and Table 5-7 lists Router B's routing table after receiving the routing updates.

Figure 14Figure 5-14 Router A Advertising Routes Learned from Router C

Table 5-6 Router B Routing Table Before Receiving the Update Shown in Figure 5-14

Group

Outgoing Interface

Next-Hop Router

Metric

Comments

162.11.7.0

E0

0

This is a directly connected route.

162.11.8.0

S0

0

This is a directly connected route.


Table 5-7 Router B Routing Table After Receiving the Update Shown in Figure 5-14

Group

Outgoing Interface

Next-Hop Router

Metric

Comments

162.11.5.0

S0

162.11.8.1

1

Learned from Router A, so next-hop is Router A.

162.11.7.0

E0

0

This is a directly connected route.

162.11.8.0

S0

0

This is a directly connected route.

162.11.9.0

S0

162.11.8.1

1

Learned from Router A, so next-hop is Router A.

162.11.10.0

S0

162.11.8.1

2

This one was learned from Router A, which learned it from Router C.


Router B adds routes for directly connected subnets when the interfaces first initialize. In fact, no routing protocols are needed for a router to learn routes to the directly connected subnets. So, before Router B receives any routing updates, it knows about only two routes—the two connected routes—as listed in Table 5-6.

After receiving the update from Router A, Router B has learned three more routes. Because Router B learned those routes from Router A, all three of B's routes point back to Router A as the next hop router. That makes sense because it is obvious from the figure that B's only path to the other subnets lies through Router A.

Router A learned about subnets 162.11.5.0 and 162.11.9.0 because A is connected directly to those subnets. Router A, in turn, learned about subnet 162.11.10.0, the subnet off Router C's Ethernet, from routing updates sent by Router C.

  • + Share This
  • 🔖 Save To Your Account