Chapter 11 Unicast Routing Protocols TCP/IP Protocol Suite Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter Outline 11.1 Introduction 11.2 Intra- and Inter-Domain Routing 11.3 Distance Vector Routing 11.4 RIP 11.5 Link State Routing 11.6 OSPF 11.7 Path Vector Routing 11.8 BGP TCP/IP Protocol Suite 2 11-1 INTRODUCTION An internet is a combination of networks connected by routers. When a datagram goes from a source to a destination, it will probably pass through many routers until it reaches the router attached to the destination network. TCP/IP Protocol Suite 3 11-2 INTER- AND INTRA-DOMAIN ROUTING Today, an internet can be so large that one routing protocol cannot handle the task of updating the routing tables of all routers. For this reason, an internet is divided into autonomous systems. An autonomous system (AS) is a group of networks and routers under the authority of a single administration. Routing inside an autonomous system is called intradomain routing. Routing between autonomous systems is called inter-domain routing TCP/IP Protocol Suite 4 Figure 11.1 Autonomous systems TCP/IP Protocol Suite 5 How does it work ? Tx • A certain “cost” or “metric” is assigned each network Rx • If #hops was the metric, we would want to traverse the least number of networks in going from Tx to Rx • In figuring out the best route from Tx to Rx, the set of networks with the smallest sum is chosen • More generically, the set of networks best meeting the “metric’s” objective is chosen • If max throughput was the metric, a fiber optic network would have a better metric than a coaxial network. TCP/IP Protocol Suite 6 Figure 11.2 Popular routing protocols • RIP – Routing Information Protocol – treats each network the same (assigns the same cost for each network) • OSPF – Open Shortest Path First protocol – assigns a cost for passing through a network based on the type of service required – routes through the network can have different cost – each router would have several tables • BGP – Border Gateway Protocol – is an exterior routing protocol that uses a policy that defines what paths should be chosen TCP/IP Protocol Suite 7 Routing Protocols vs. Algorithms Routing protocols allow routers to share info with one another dynamically - as the Internet makes changes, the routing protocols allow routers to inform other routers Routers communicate to their neighboring routers - gossip Routing protocols implement the procedures for combining info received from other routers Routing Algorithms – decision making analysis – the “brains” – using the info provided TCP/IP Protocol Suite 8 11-3 DISTANCE VECTOR ROUTING Bellman-Ford Algorithm TCP/IP Protocol Suite 9 Figure 11.4 The fact behind Bellman-Ford algorithm TCP/IP Protocol Suite 10 TCP/IP Protocol Suite 11 RIP Algorithm Distance Vector Algorithm built from Bellman-Ford Algorithm Recall: each router sends message to it’s neighbor For the router receiving a RIP response 1st – add one to hop count for each destination advertised 2nd – repeat the following steps for each advertised destination 1. If destination is not in table add destination to table 2. Else if destination is in table 1. If next-hop field is the same replace entry in table with advertised one 2. Else next-hop different replace entry if advertised hop count is less TCP/IP Protocol Suite 12 Example 11.1 Figure 11.5 shows the initial routing table for an AS. Note that the figure does not mean that all routing tables have been created at the same time; each router creates its own routing table when it is booted. TCP/IP Protocol Suite 13 Figure 11.6 Example 11.2 4 2 3 Net5 , 1Net4 , 1Net2 , 1 TCP/IP Protocol Suite 14 Figure 11.7 Example 11.3 TCP/IP Protocol Suite 15 RIP Algorithm • Router receives RIP message for some router C • The RIP message list destination networks, corresponding hop count • 1st step: increment hop count • Net1: no news, don’t change • Net2: same next hop, so replace 2 with 5 • Net 3: new router, so add • Net 6: different next hop, new hop count less, so replace • Net 8: different next hop, new hop count the same, don’t change • Net 9: different next hop, new hop count larger, do not change TCP/IP Protocol Suite 16 11-4 RIP The Routing Information Protocol (RIP) is an intradomain (interior) routing protocol used inside an autonomous system. It is a very simple protocol based on distance vector routing. RIP implements distance vector routing directly with some considerations. TCP/IP Protocol Suite 17 Figure 11.10 Example of a domain using RIP TCP/IP Protocol Suite 18 Figure 11.11 RIP message format • Command – 8-bit field specifying the type of message: response (2) or request (1) • Version – 8-bit field specifying RIP version • Family – 16-bit specifying protocol family (TCP/IP=2) • Network Address – address of the destination network • Distance – 32-bit field defining the hop count from advertising router to destination network NOTE: Request can be issued by a newly added router or by a router seeking certain info NOTE: 2 response types: Solicited – response to request, Unsolicited – periodic updates Gray fields repeated for each destination network TCP/IP Protocol Suite 19 Example What is the periodic response sent by router R1 in the figure below. Assume R1 knows about the whole autonomous system. TCP/IP Protocol Suite 20 Solution R1 can advertise three networks 144.2.7.0, 144.2.9.0, and 144.2.12.0. The periodic response (update packet) is shown below TCP/IP Protocol Suite 21 Figure 11.13 Solution to Example 11.4 TCP/IP Protocol Suite 22 Figure 11.14 RIP timers • Periodic Timer – each router has timer set to 25-35 secs and when the timer counts down, an update message is sent • Expiration Timer – governs the validity of the next-hop – when router receives next-hop update, timer is set to 180 sec. If there is a problem and the router doesn’t receive it’s 30 sec update, the route info expires (invalid) after the 180 sec count down – then the hop count is set to 16 (infinity) • Garbage Collection Timer – once the route expires, this timer is set to 120 sec and counts downs – allows neighbors time to become aware of invalidity – after count down, info is purged TCP/IP Protocol Suite 23 Example 11.5 A routing table has 20 entries. It does not receive information about five routes for 200 s. How many timers are running at this time? Solution The 21 timers are listed below: Periodic timer: 1 Expiration timer: 20 − 5 = 15 Garbage collection timer: 5 TCP/IP Protocol Suite 24 RIP Problem – Count to Infinity Any decrease in cost propagates quickly, but any increase in cost propagates slowly. If a link is broken, this takes some time --- count to infinity Slow Convergence – the time it takes a change in the Internet to propagate through the rest of the Internet – recall the periodic updates with neighbors. DEPENDING ON THE DATA RATE, millions or billions of bits could be sent in that time – therefore possibly lost TCP/IP Protocol Suite 25 Figure 11.8 Two-node instability • RA and RB has hop counts 1 and 2, respectively for X • X goes down – RA can update fast due to direct connection – sets hop count to ∞ • RA has to wait 30 sec to update RB (this is the problem) • In meanwhile, RB sends update to RA with hop count 2 for X (incremented to 3) • Now when RA finally send the update to RB, it sends a hop count of 3 (incremented to 4) – RA thinks it’s another route to X • This INSTABILITY (back-andforth) continues until both set hop count to ∞ TCP/IP Protocol Suite 26 Note RIP uses the services of UDP on wellknown port 520. TCP/IP Protocol Suite 27 Figure 11.2 Popular routing protocols • RIP – Routing Information Protocol – treats each network the same (assigns the same cost for each network) • OSPF – Open Shortest Path First protocol – assigns a cost for passing through a network based on the type of service required – routes through the network can have different cost – each router would have several tables • BGP – Border Gateway Protocol – is an exterior routing protocol that uses a policy that defines what paths should be chosen TCP/IP Protocol Suite 28 11-5 LINK STATE ROUTING Link state routing has a different philosophy from that of distance vector routing. In link state routing, if each node in the domain has the entire topology of the domain—the list of nodes and links, how they are connected including the type, cost (metric), and the condition of the links (up or down)—the node can use the Dijkstra algorithm to build a routing table. TCP/IP Protocol Suite 29 Figure 11.17 Concept of Link state routing TCP/IP Protocol Suite 30 Figure 11.18 Link state knowledge TCP/IP Protocol Suite 31 Figure 11.19 Forming shortest path three for router A in a graph TCP/IP Protocol Suite 32 Figure 11.19 Continued TCP/IP Protocol Suite 33 Figure 11.19 Continued TCP/IP Protocol Suite 34 Example 11.6 To show that the shortest path tree for each node is different, we found the shortest path tree as seen by node C (Figure 11.20). We leave the detail as an exercise. TCP/IP Protocol Suite 35 Figure 11.20 Example 11.6 TCP/IP Protocol Suite 36 11-6 OSPF The Open Shortest Path First (OSPF) protocol is an intra-domain routing protocol based on link state routing. Its domain is also an autonomous system. TCP/IP Protocol Suite 37 Figure 11.21 Areas in an autonomous system • Divide autonomous system (AS) into areas • Routers with in an area floods the area with routing info – router sends to all it’s neighbors and each neighbor sends to all it’s neighbors and etc.. • At the border of an area, special routers called area border routers are used to (1) summarize info about an area and (2) send info amongst areas • A special area called the backbone is used to tie together all of the areas – backbone is primary area and all other areas are secondary areas – backbone area uses backbone routers. Each area has an ID (backbone’s Id is 0) TCP/IP Protocol Suite 38 OSPF: Open Shortest Path First The OSPF is similar to RIP however, it allows the admin the ability to assign a cost or metric to each route. The metric can be based on a type of service (ie . Min delay, max throughput, etc..) Unlike RIP, sharing or updating is done when there is a change (not periodically) For OSPF, the objective is for the routers to contain the full picture or topology of the Internet – by having this, the router can figure out the “shortest path” or “least cost” route between itself and each network To do this, the Internet is represented by a graph – set of edges and nodes TCP/IP Protocol Suite 39 Figure 11.22 Types of links TCP/IP Protocol Suite 40 Defining edges or connections/links Point-to-point link Virtual link Direct connection between two routers, no IP address needed Bi-directional Edge When link between two routers are broken, admin creates a new route across multiple routers Transient link Stub link Represents the network TCP/IP Protocol Suite Connects to only one router – packets enter and leave through this same router 41 Figure 11.26 Example of an AS and its graphical representation in OSPF TCP/IP Protocol Suite 42 Building Routing Table 1. Create the initial state of the links of each node. 2. Disseminate the link state package (LSP) to every other router, called flooding. 3. Construct a shortest path tree for each node (Dijkstra Algorithm). 4. Calculate a routing table based on the shortest path tree. TCP/IP Protocol Suite 43 Routing Table based on Shortest Path Tree TCP/IP Protocol Suite 44 11-7 DISTANCE VECTOR ROUTING Distance vector and link state routing are both interior routing protocols. They can be used inside an autonomous system. Both of these routing protocols become intractable when the domain of operation becomes large. Distance vector routing is subject to instability if there is more than a few hops in the domain of operation. Link state routing needs a huge amount of resources to calculate routing tables. It also creates heavy traffic because of flooding. There is a need for a third routing protocol which we call path vector routing. TCP/IP Protocol Suite 45 Example 11.10 The difference between the distance vector routing and path vector routing can be compared to the difference between a national map and an international map. A national map can tell us the road to each city and the distance to be traveled if we choose a particular route; an international map can tell us which cities exist in each country and which countries should be passed before reaching that city. TCP/IP Protocol Suite 46 Figure 11.50 Reachability TCP/IP Protocol Suite 47 Figure 11.51 Stabilized table for three autonomous system TCP/IP Protocol Suite 48 Figure 11.52 Routing tables after aggregation TCP/IP Protocol Suite 49 11-8 BGP Border Gateway Protocol (BGP) is an interdomain routing protocol using path vector routing. It first appeared in 1989 and has gone through four versions. TCP/IP Protocol Suite 50 Note BGP uses the services of TCP on port 179. TCP/IP Protocol Suite 51 Summaries: To introduce the idea of autonomous systems (ASs) that divide the Internet into smaller administrative regions. To discuss the idea of distance vector routing and the RIP that is used to implement the idea. To discuss the idea of link state routing as the second intra-AS routing method and OSPF that is used to implement the idea. To discuss the idea of path vector routing as the dominant interAS routing method and BGP that is used to implement the idea. TCP/IP Protocol Suite 52