Department of Engineering Science ES465/CES 440, Intro. to Networking & Network Management WAN Technologies & Dynamic Routing http://www.sonoma.edu/users/k/kujoory References • “Computer Networks & Internet,” Douglas Comer, 6th ed, Pearson, 2014, Ch 18, Textbook, 5th ed, slides by Lami Kaya (LKaya@ieee.org) with some changes. • “Computer Networks,” A. Tanenbaum, 5th ed., Prentice Hall, 2011, ISBN: 13:978013212695-3. • “Computer & Communication Networks,” Nader F. Mir, 2nd ed, Prentice Hall, 2015, ISBN: 13: 9780133814743. • “Data Communications Networking,” Behrouz A. Forouzan, 4th ed, Mc-Graw Hill, 2007 • “Data & Computer Communications,” W. Stallings, 7th ed., Prentice Hall, 2004. • “Computer Networks: A Systems Approach," L. Peterson, B. Davie, 4th Ed., Morgan Kaufmann 2007. Ali Kujoory 6/30/2016 Not to be reproduced without permission 1 Topics Covered • • • • • • • • • • • • • • 18.1 Introduction 18.2 Large Spans & Wide Area Networks 18.3 Traditional WAN Architecture 18.4 Forming a WAN 18.5 Store & Forward Paradigm 18.6 Addressing in a WAN 18.7 Next-Hop Forwarding 18.8 Source Independence 18.9 Dynamic Routing Updates in a WAN 18.10 Default Routes 18.11 Forwarding Table Computation 18.12 Distributed Route Computation 18.13 Shortest Path Computation in a Graph 18.14 Routing Problems Ali Kujoory 6/30/2016 Not to be reproduced without permission 2 18.1 Introduction • This chapter – considers the structure of a network that spans an arbitrarily large area – describes the basic components used to build a packet switching system – explains the fundamental concept of routing – presents the two basic routing algorithms – explains the advantages of each algorithm – extends the discussion of routing to the Internet – presents routing protocols that use the algorithms described here Ali Kujoory 6/30/2016 Not to be reproduced without permission 3 18.2 Large Spans & Wide Area Networks • Networking technologies can be classified according to the distance spanned: – PAN spans a region near an individual – LAN spans a building or campus – MAN spans a large metropolitan area – WAN spans multiple cities or countries Ali Kujoory 6/30/2016 • Consider a company that uses a satellite bridge to connect LANs at two sites – Should the network be classified as a WAN or as an extended LAN? Not to be reproduced without permission 4 18.2 Large Spans & Wide Area Networks • The key issue that separates WAN technologies from LAN technologies is scalability • A WAN must be able to grow as needed to connect many sites – spread across large geographic distances • A technology is not classified as a WAN unless it can deliver reasonable performance for a large scale network – A WAN does not merely connect to many computers at many sites • it must provide sufficient capacity to permit all computers to communicate • Thus, a satellite bridge that connects a pair of PCs & printers is merely an extended LAN Ali Kujoory 6/30/2016 Not to be reproduced without permission 5 18.3 Traditional WAN Architecture • WAN designers chose to create a special-purpose hardware device that could be placed at each site • A packet switch provides – local connections for computers at the site, & – connections for data circuits that lead to other sites • A packet switch consists of a small computer system Ali Kujoory 6/30/2016 – with a processor, memory, & I / O devices used to send & receive packets • Early packet switches were constructed from conventional computers – the packet switches used in the highest-speed WANs require special-purpose hardware • Fig. 18.1 illustrates the internal packet switch architecture Not to be reproduced without permission 6 18.3 Traditional WAN Architecture Ali Kujoory 6/30/2016 Not to be reproduced without permission 7 18.3 Traditional WAN Architecture • Since the advent of LAN technology, most WANs separate a packet switch into two parts: – a Layer 2 switch that connects local computers – a router that connects to other sites • Part 4 of the text – discusses Internet routers in detail, & – explains how the concepts covered here apply to the Internet • Communication with local computers can be separated from transmission across a WAN • Fig. 18.2 illustrates the separation Ali Kujoory 6/30/2016 Not to be reproduced without permission 8 18.3 Traditional WAN Architecture or Layer 3 Switch & Internet Ali Kujoory 6/30/2016 Not to be reproduced without permission 9 18.4 Forming a WAN • A WAN can be formed by interconnecting a set of sites • The exact details of the interconnections depend on – the data rate needed – the distance spanned, & – the delay • Many WANs use leased data circuits – However, other forms are also available such as • microwave & satellite channels Ali Kujoory 6/30/2016 • A network designer must choose a topology – For a given set of sites, many topologies are possible • Fig. 18.3 illustrates a possible way to interconnect – a WAN does not need to be symmetric in the interconnections among packet switches – the capacity of each connection can be chosen to accommodate the expected traffic & provide redundancy in case of failure Not to be reproduced without permission 10 18.4 Forming a WAN Ali Kujoory 6/30/2016 Not to be reproduced without permission 11 18.5 Store & Forward Paradigm • The goal of a WAN is to allow as many computers as possible to send packets simultaneously • The fundamental paradigm used to achieve simultaneous transmission is known as store & forward • To perform store & forward processing – a packet switch buffers packets in memory Ali Kujoory 6/30/2016 • The store operation occurs when a packet arrives: – I / O hardware in the switch places a copy of the packet in memory • The forward operation occurs once a packet has arrived & is waiting in memory. The processor – examines the packet – determines its destination, & – sends the packet over the I / O interface that leads to the destination Not to be reproduced without permission 12 18.6 Addressing in a WAN • From the view of an attached computer – a traditional WAN network operates similar to a LAN – Each WAN technology defines the exact frame format a computer uses when sending & receiving data – Each computer connected to a WAN is assigned an address • WANs addresses follow a key concept that is used in the Internet: hierarchical addressing Ali Kujoory 6/30/2016 Net_ID Host_ID – Hierarchical addressing divides each address into two parts: (site, computer at the site) – In practice, instead of a identifying a site, each packet switch is assigned a unique # • first part of an address identifies a packet switch • second part identifies a specific computer • Fig. 18.4 shows two-part hierarchical addresses assigned to computers connected to a pair of packet switches Not to be reproduced without permission 13 18.6 Addressing in a WAN Ali Kujoory 6/30/2016 Not to be reproduced without permission 14 18.6 Addressing in a WAN • Fig. 18.4 shows each address as a pair of decimal integers – A computer connected to port 6 on packet switch 2 is assigned address [2, 6] • In practice, an address is represented as a single binary value with some bits of the binary value • In Part 4 of the text, we’ll show that each Internet address consists of a binary #, where – a prefix (NET_ID) of the bits identify a specific network in the Internet – the remainder of the bits identify a computer attached to the network (HOST_ID) – used to represent a packet switch, & – others used to identify a computer Ali Kujoory 6/30/2016 Not to be reproduced without permission 15 18.7 Next-Hop Forwarding • What is the importance of hierarchical addressing? • When a packet arrives • To make the choice, a packet switch – a switch must choose an outgoing path over which to forward it • If a packet is destined – for a local computer • the switch sends the packet directly to the computer – Otherwise • the packet must be forwarded over to another switch Ali Kujoory 6/30/2016 – examines the destination address in the packet & – extracts the packet switch # • If the # in the destination address is identical to the packet switch's own ID the packet is intended for a computer on the local packet switch • Otherwise, the packet is intended for a computer on another switch • Algorithm 18.1 explains the computation Not to be reproduced without permission 16 18.7 Next-Hop Forwarding Ali Kujoory 6/30/2016 Not to be reproduced without permission 17 Figure 22.1 Direct & Indirect Delivery (from Forouzan) 22.18 Ali Kujoory 6/30/2016 Not to be reproduced without permission 18 Figure 22.2 Route Method versus Next-hop Method Full Route Long! Ali Kujoory 6/30/2016 Not to be reproduced without permission Next hop Route Short 22.19 19 Figure 22.3 Host-specific Versus Network-specific Method Host Specific Long table! Network Specific Short table Used for default • Network specific makes the routing table much simpler & more efficient. Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.20 20 Figure 22.4 Default Method Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.21 21 Figure 22.5 Simplified Forwarding Module In Classless Address In classless addressing, we need at least four columns in a routing table. Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.22 22 Example 22.1 For Fig. 22.6, make a routing table for router R1. Open a blank table with the following columns: 1. Mask column list the total number of 1-bits to be used for ANDing with the desired destination addresses. 2. Network address with lists the destination network addresses. 3. Next Hop lists the network addresses toward the destination & the Interface can take care of it. 4. Interface list the interfaces of the current switch for the next hop. Filling up the entries is very easy. • Enter the network address of each network, its corresponding mask, & port it is connected to in the 2nd,1st, & 4th columns, respectively. • The last row (Any) is used for all addresses not covered by the networks. Table 22.1 Routing table for router R1 in Figure 22.6 Ali Kujoory Not to be reproduced without permission 6/30/2016 Figure 22.6 Configuration for Example 22.1 22.23 23 Example 22.2 Given the routing table, show the forwarding process if a packet arrives at R1 in Fig. 22.6 with the destination address 180.70.65.140. The router performs the following steps: • 1st mask (/26) is applied to the destination address. The result is 180.70.65.128, which does not match the corresponding network address. • 2nd mask (/25) is applied to the destination address. The result is 180.70.65.128, which matches the corresponding network address. The nexthop address & the interface number m0 are passed to ARP for further processing. Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.24 24 Example 22.3 Given the routing table, show the forwarding process if a packet arrives at R1 in Figure 22.6 with the destination address 201.4.22.35. The router performs the following steps: • 1st mask (/26) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address. • 2nd mask (/25) is applied to the destination address which does not match the corresponding network address. • 3rd mask (/24) is applied to the destination address. The result is 201.4.22.0, which matches the corresponding network address. The destination address of the packet & the interface number m3 are passed to ARP. Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.25 25 Example 22.4 Given the routing table, show the forwarding process if a packet arrives at R1 in Figure 22.6 with the destination address 18.24.32.78. This time all masks are applied, one by one, to the destination address, but no matching network address is found. • When it reaches the end of the table, the module gives the next-hop address 180.70.65.200 & interface number m2 to ARP. • This is probably an outgoing package that needs to be sent, via the default router, to someplace else in the Internet. Ali Kujoory 6/30/2016 Not to be reproduced without permission 22.26 26 18.7 Next-Hop Forwarding • A packet switch does not need to keep complete information about how to reach all possible computers – nor does a switch need to compute the entire route a packet will follow – which means that a switch only needs to know which outgoing link • A switch only needs to compute the next hop for a packet 6/30/2016 – is analogous to the way airlines list flights • To make the computation efficient • Instead, a switch bases forwarding on packet switch IDs Ali Kujoory • The process is called next-hop forwarding & – switches use table lookup – that is, each packet switch contains a forwarding table – such tables were originally called routing tables • lists all possible packet switches • & gives a next hop for each • Fig. 18.5 illustrates next-hop forwarding with a trivial example Not to be reproduced without permission 27 18.7 Next-Hop Forwarding Ali Kujoory 6/30/2016 Not to be reproduced without permission 28 18.7 Next-Hop Forwarding • Using only one part of a twopart hierarchical address to forward a packet has two practical consequences 1. the computation time required to forward a packet is reduced because the forwarding table can be organized as an array that uses indexing instead of searching 2. the forwarding table contains one entry per packet switch instead of one entry per destination computer • The reduction in table size can be substantial Ali Kujoory 6/30/2016 – Esp. for a large WAN that has many computers attached to each packet switch • A two-part hierarchical addressing scheme allows packet switches to use only the first part (Net_ID) of the destination address until the packet reaches the final switch – Once the packet reaches the final switch • the switch uses the second part of the address (Host-ID) to choose a specific computer – As Algorithm 18.1 described Not to be reproduced without permission 29 18.8 Source Independence • Next-hop forwarding does not depend on the packet's original source or on the path the packet has taken before it arrives at a particular packet switch – Instead, the next hop to which a packet is sent depends only on the packet's destination – The concept is known as source independence • Like postal service & Airline • Source independence allows the forwarding mechanism in a computer network to be compact & efficient Ali Kujoory 6/30/2016 – Because all packets follow the same algorithm, only one table is required – Because forwarding does not use source information, only the destination address needs to be extracted from a packet – A single mechanism handles forwarding uniformly packets that originate on directly connected computers & • packets that arrive from other packet switches use the same mechanism Not to be reproduced without permission 30 Desirable Characteristics of Routing Algorithms • • • • • • Correct to deliver Simple to implement Robust against failures Stable against traffic variation (converge to equilibrium) Fair to all users Optimal to network – least delay, max throughput, or least jitter • Dynamic (Adaptive to changes) in – Topology • Failures of network elements – Configuration • Network elements added / removed – Traffic • Load of the network • Static routing algorithms o not adaptive to changes o Are unacceptable for large networks • Dynamic routing algorithm is used for large networks since it is most efficient – Quality of service • Delay, throughput, loss Ali Kujoory 6/30/2016 Not to be reproduced without permission 31 18.9 Dynamic Routing Updates in a WAN Forwarding table must guarantee the following: • Universal communication – The forwarding table in each switch must contain a valid next-hop route for each possible destination address • Optimal routes – In a switch, the next-hop value in the forwarding table for a given destination must point to the shortest path to the destination • Network failures further complicate forwarding Ali Kujoory 6/30/2016 – E.g., if two paths exist to a given destination & one of the paths becomes unavailable because hardware fails, forwarding should be changed to avoid the unavailable path – A network manager cannot merely configure a forwarding table that contain static values that do not change – Instead, software running on the packet switches continually tests for failures, & reconfigures the forwarding tables automatically Not to be reproduced without permission 32 18.9 Dynamic Routing Updates in a WAN • We use the term routing software to describe software that automatically reconfigures forwarding tables • Route computation in a WAN is to think of a graph that models the network – software uses the graph to compute the shortest path to all possible destinations • Each node in the graph corresponds to a packet switch in the network – individual computers are not part of the graph • If the network contains a direct connection between a pair of packet switches – the graph contains an edge or link between the corresponding nodes • Fig. 18.6 shows an example WAN & the corresponding graph Ali Kujoory 6/30/2016 Not to be reproduced without permission 33 18.9 Dynamic Routing Updates in a WAN • For dynamic routing computation, graphs are used since mathematical tools are available Ali Kujoory 6/30/2016 Not to be reproduced without permission 34 18.9 Dynamic Routing Updates in a WAN • As Fig. 18.6 shows, nodes in the graph are given a label – is the same as the # assigned to the corresponding packet switch • A graph representation is useful in computing next-hop forwarding – because graph theory has been studied & efficient algorithms have been developed – a graph abstracts away details, allowing routing software to deal with the essence of the problem Ali Kujoory 6/30/2016 • When it computes next-hop forwarding for a graph – a routing algorithm must identify a link • Our examples will use the notation (k, j) to denote a link from node k to node j – When a routing algorithm runs on the graph in Fig. 18.6b – The algorithm produces output as shown in Fig. 18.7 Not to be reproduced without permission 35 18.9 Dynamic Routing Updates in a WAN Fig. 18.6b graph of WAN. Fig. 18.7 A forwarding table for each node in the graph of Fig. 18.6b. Ali Kujoory 6/30/2016 Not to be reproduced without permission 36 18.10 Default Routes • The forwarding table for node 1 in Fig. 18.7 raises an important point: – a forwarding table may contain many entries that point to the same next hop • An examination of the WAN in Fig. 18.6a reveals why all remote entries contain the same next hop: – the packet switch has only one connection to the network Ali Kujoory 6/30/2016 – therefore, all outgoing traffic must be sent across the same connection – consequently, except for the entry that corresponds to the node itself, • all entries in node1's forwarding table have a next hop that points to the link from node1 to node3 • In our trivial example, the list of duplicate entries in the forwarding table is short Not to be reproduced without permission 37 18.10 Default Routes • A large WAN may contains hundreds of duplicate entries • Most WAN systems include a mechanism that can be used to eliminate the common case of duplicate entries • Default route is a mechanism that allows a single entry in a forwarding table to replace a long list of entries that have the same next-hop value – & the entry has lower priority than other entries • If the forwarding mechanism does not find an explicit entry for a given destination – it uses the default • Fig. 18.8 shows the forwarding tables from Fig. 18.7 revised to use a default route – Only one default entry is allowed in a forwarding table Ali Kujoory 6/30/2016 Not to be reproduced without permission 38 18.10 Default Routes Fig. 18.7 A forwarding table for each node in the graph of Fig. 18.6b. * = Default Route makes the table shorter Fig. 18.8 A forwarding tables from Fig. 18.7 with default routes denoted by an an asterisk. Ali Kujoory 6/30/2016 Not to be reproduced without permission 39 18.10 Default Routes • Default routing is optional – a default entry is present only if more than one destination has the same next-hop value • E.g., the forwarding table for node3 does not contain a default route – because each entry has a unique next hop • However, the forwarding table for node1 benefits from a default route – because all remote destinations have the same next hop Ali Kujoory 6/30/2016 Not to be reproduced without permission 40 18.11 Forwarding Table Computation Basic approaches to construct forwarding tables: • Static routing – A program computes & installs routes when a packet switch boots – The routes do not change • Dynamic routing – A program builds an initial forwarding table when a switch boots – Program then alters the table as conditions in the network change Ali Kujoory 6/30/2016 • Each approach has advantages & disadvantages – Advantages of static routing are simplicity & low overhead – Disadvantage is inflexibility • static routes cannot be changed when communication is disrupted • Large networks are designed with redundant connections to handle occasional hardware failures – most WANs use a form of dynamic routing Not to be reproduced without permission 41 Figure 22.12 Autonomous Systems • An internet can be so large that one routing protocol cannot handle updating the routing tables. • Thus, an internet is divided into Autonomous System. • An AS is a group of networks & – routers are under the authority of a single administration. 22.42 Ali Kujoory 6/30/2016 • Routing inside an autonomous system is called intradomain routing. – Each AS can choose one or more intradomain routing protocols inside AS. • Routing outside an autonomous system is called interdomain routing. – Only one interdomain routing protocol can be used between ASes Not to be reproduced without permission 42 Figure 22.13 Popular Routing Protocols (Routing Information Protocol) 22.43 Ali Kujoory 6/30/2016 (Open Shortest Path First) (Border Gateway Protocol) Not to be reproduced without permission 43 Figure 22.14 Distance Vector Routing (DVR) Tables • In DVR, the least-cost route between any two nodes is the route with minimum distance. • Each node maintains a vector (table) of minimum distance to every node. • The table at each node guides the packets to the desired node using the next hop in the route, e.g., – In an area, cities are nodes, lines are the roads connecting the cities we take to destination. • DVR uses three phases: Initialization, Sharing, Updating. Cost is a metric, e.g., # of hops 22.44 Ali Kujoory 6/30/2016 Not to be reproduced without permission 44 Figure 22.15 Initialization of Tables In Distance Vector Routing Initialization: • In the beginning, each node can know only the distance between itself & its immediate neighbors, those directly connected to it. • Use infinity for the distance (cost) to the nodes not neighbor (not known). 22.45 Ali Kujoory 6/30/2016 Not to be reproduced without permission 45 Sharing of Tables with all Neighboring Nodes Routing In distance vector routing, each node shares its routing table with its immediate neighbors periodically & when there is a change. Sharing: • Each node shares its routing table with its neighboring node, e.g., – Although node A does not know about node E, node C does. • So if node C shares its routing table with A, – node A can also know how to reach E, & so on. • Question: – How much of the table should be shared? – The 3rd column does not help, so it is not sent. 22.46 Ali Kujoory 6/30/2016 Not to be reproduced without permission 46 Figure 22.16 Updating in Distance Vector Routing Updating in three steps: 1. Receiving node adds the cost between itself & sending node in the 2nd column. If node C claims its distance to a destination is x mi, & the distance between A & C is y mi, the distance between A & that destination, via C, is x + y mi, 2. Receiving node adds the name of the sending node to the 3rd column for all entries indicating the sending node is the next node in the route. 3. Receiving node compares each row of its old table with the corresponding row of the modified version of the received table & uses the lower cost. 22.47 Ali Kujoory 6/30/2016 Not to be reproduced without permission 47 Routing Information Protocol (RIP) • RIP is an intradomain routing protocol used in an autonomous system. • It is very simple routing protocol based on DVR. • The destinations in a routing table is a network, thus the first column defines a network address. • RIP uses hop count for the metric, that makes things very simple. • Infinity is defined as 16; so any route used by RIP in AS cannot be more than 15. • The next node column defines the address of the router in which the packet is to be sent to reach the destination. 22.48 Ali Kujoory 6/30/2016 Not to be reproduced without permission 48 Figure 22.19 Example of a Domain Using RIP 22.49 Ali Kujoory 6/30/2016 Not to be reproduced without permission 49 Figure 22.20 Link State Routing (LSR) • In LSR each node has the entire topology of the domain – The list of nodes & links, how they are connected for cost (metric), & – whether they are up or down • Nodes use Dijkstra’s algorithm to build the routing table https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm • Analogy: In a city, each person may the same map but uses different route to reach her/his destination. Domain, same for all nodes Routing table, different for each node 22.50 Ali Kujoory 6/30/2016 Not to be reproduced without permission 50 Figure 22.21 Link State Knowledge 22.51 Ali Kujoory 6/30/2016 Not to be reproduced without permission 51 How Link-State Works https://en.wikipedia.org/wiki/Link-state_routing_protocol • The link-state protocol is performed by every switching node (routers that forward packets) in the network • Every node constructs a map of the connectivity to the network – in the form of a graph, showing – which nodes are connected to which other nodes • Each node then independently calculates the next best logical path from it to every possible destination in the network • The collection of best paths will then form the node's routing table Ali Kujoory 6/30/2016 • This contrasts with DistanceVector Routing protocols which work by having each node share its routing table with its neighbors, • In a link-state protocol the only information passed between nodes is connectivity related • Each node floods its LSP to every other router in an efficient & reliable way – Link-state algorithms are sometimes characterized informally as each router “telling the world about its neighbors” Not to be reproduced without permission 52 Shortest Path Routing Example Problem • Find shortest path between nodes A & D • Use Dijkstra’s algorithm Solution • Build a graph of the subnet with – Each node representing a router – Each arch representing a link • Make a weighted undirected graph – By marking each arc with the desired path metric – Examples of path metric: • # Of hops, geographic distance, queuing / transmission delay, BW, communication costs Ali Kujoory 6/30/2016 • In the figures of the following slide – Weights on the arcs show the distances = path metric – Arrow indicates the working node – (¥,-) indicates path is not known • Start with node A • Then examine each adjacent node • Relabel each by distance from source node along the best known path • Continue this to other nodes See also the program in Tanenbaum Fig. 5-8, oo= ¥ Not to be reproduced without permission 53 Shortest Path Routing (2) B 2 7 2 A 6 E 2 C F 1 3 F(oo,-) G(6,A) B(2,A) F(6,E) D(oo,-) G(5,E) H(9,G) (e) F is working node. It is made permanent. Ali Kujoory 6/30/2016 F(6,E) D(oo,-) H(oo,-) G(5,E) (d) Shorter distance from A is via E. So relabel & mark permanent. B(2,A) C(9,B) C(9,B) E(4,B) D(oo,-) C(9,B) E(4,B) D(oo,-) A (c) Calculate distances from A. If shortest, label the node as permanent. A F(oo,-) G(6,A) H(oo,-) (b) Relabel adjacent nodes with distance from A. H(oo,-) B(2,A) E(oo,-) A C(9,B) E(4,B) A C(oo,-) 2 4 G H (a) Start at node A & mark it as permanent. B(2,A) B(2,A) 3 D 2 via E(4,B) A F(6,E) G(5,E) D(10,H) H(8,F) (f) H is working node. Via F is shorter. Relabel & make permanent. Not to be reproduced without permission 54 18.12 Distributed Route Computation • Algorithm 18.2 shows how a forwarding table can be computed • There are two general forms: – after information about a network is encoded in a graph – Link-State Routing (LSR), which uses Dijkstra's algorithm – Distance-Vector Routing (DVR), which uses another approach • In practice, WANs need to perform distributed route computation – Instead of a centralized program computing all shortest paths • The next sections describe each of the two approaches • each packet switch must compute its own forwarding table locally Ali Kujoory 6/30/2016 – All packet switches must participate in distributed route computation – Chapter 26 explains how each approach is used to control routes in the Internet Not to be reproduced without permission 55 18.12.1 Link-State Routing (LSR) • Link-state routing or Linkstatus routing – the approach also known as Shortest Path First (SPF) routing – Dijkstra algorithm used it to characterize the way it works • actually all routing algorithms find shortest paths • To use LSR, packet switches periodically send messages across the network that carry the status of a link – Link-State Ali Kujoory 6/30/2016 – E.g., packet switches 5 & 9 measure the link between them & send a status message • such as “the link between 5 & 9 is up” – Each status message is broadcast to all switches • Every switch collects incoming status messages – & uses them to build a graph of the network • Each switch then uses Algorithm 18.2 to produce a forwarding table by choosing itself as the source Not to be reproduced without permission 56 Algorithm 18.2 A version of Dijkstra’s algorithm that computes R, a nexthop forwarding table, & D, the distance to each node from the specified source node Ali Kujoory 6/30/2016 Not to be reproduced without permission 57 18.12.1 Link-State Routing (LSR) • An LSR algorithm can adapt to hardware failures • If a link between packet switches fails – the attached packet switches will detect the failure & – broadcast a status message that specifies the link is down • All packet switches receive the broadcast – change their copy of the graph • to reflect the change in the link's status & – re-compute shortest paths • Similarly, when a link becomes available again – the packet switches connected to the link detect that • it is working & – start sending status messages that report its availability Ali Kujoory 6/30/2016 Not to be reproduced without permission 58 18.12.2 Distance Vector Routing (DVR) • In DVR, each link in the network is assigned a weight, as with LSR • The distance to a destination between two packet switches is defined to be the sum of weights along the path between the two • Like LSR, DVR arranges for packet switches to exchange messages periodically Ali Kujoory 6/30/2016 • In DVR, a switch sends a complete list of destinations & the current cost of reaching each • When it sends a DVR message – a switch is sending a series of individual statements, of the form: “I can reach destination X, & its current distance from me is Y” Not to be reproduced without permission 59 18.12.2 Distance Vector Routing (DVR) • DVR messages are not broadcast – Each switch periodically sends a DVR message to its neighbors • Each message contains pairs of (destination, distance) • Each packet switch must keep a list 0f • DVR software can be considered as maintaining an extension to the forwarding table that – stores a distance for each destination – possible destinations, – the current distance to the destination, – the next hop to use for each in the forwarding table Ali Kujoory 6/30/2016 Not to be reproduced without permission 60 18.12.2 Distance Vector Routing (DVR) • When a message arrives at a switch from neighbor N – the switch examines each item in the message & – changes its forwarding table if the neighbor has a shorter path to some destination than the path currently being used Example: • If neighbor N advertises a path to destination D as having cost 5 & the current path through neighbor K has cost 100 – the current next hop for D will be replaced by N & – the cost to reach D will be 5 plus the cost to reach N • Algorithm 18.3 specifies how routes are updated when using the distance-vector approach Ali Kujoory 6/30/2016 Not to be reproduced without permission 61 Algorithm 18.3 Distance-vector algorithm for route computation Ali Kujoory 6/30/2016 Not to be reproduced without permission 62 18.13 Shortest Paths & Weights • Once a graph has been created that corresponds to a network – software uses a method known as Dijkstra's Algorithm • To find the shortest path from a source node to each of the other nodes in the graph: – A next-hop forwarding table is constructed during the computation of shortest paths – The algorithm must be run once for each node in the graph – That is, to compute the forwarding table for packet switch P • the node that corresponds to P is designated as the source node & • the algorithm is run Ali Kujoory 6/30/2016 Not to be reproduced without permission 63 18.13 Shortest Paths & Weights • Dijkstra's algorithm is popular – because it can be used with various definitions of shortest path – In particular, the algorithm does not require edges in the graph to represent geographic distance. Instead, the algorithm • allows each edge to be assigned a nonnegative value called a weight • defines the distance between two nodes to be the sum of the weights along a path between the nodes • Fig. 18.9 illustrates the concept of weights by – showing an example graph with an integer weight assigned to each edge & – a least-weight path between two nodes in the graph Ali Kujoory 6/30/2016 Not to be reproduced without permission 64 18.13 Shortest Paths & Weights Ali Kujoory 6/30/2016 Not to be reproduced without permission 65 18.13 Shortest Paths & Weights • Dijkstra's algorithm maintains a Set of nodes, S – for which the min distance & next hop have not been computed • The set is initialized to all nodes except the source • The algorithm then iterates until set S is empty • On each iteration – the algorithm removes a node from S that has the least distance from the source – As it deletes node u, the algorithm examines the current distance from the source to each of the neighbors of u • that remains in the set – If a path from the source through u to the neighbor has less weight than the current path, the algorithm updates the distance to the neighbor • After all nodes have been removed from S – the algorithm will have computed the min distance to each node & • a correct next-hop forwarding table for all possible paths Ali Kujoory 6/30/2016 Not to be reproduced without permission 66 18.13 Shortest Paths & Weights • Dijkstra's algorithm needs 3 data structures to store: – current distance to each node – next hop for the shortest path – information about the remaining set of nodes • Nodes can be numbered from 1 to n as Fig. 18.9 – which makes the implementation efficient • because a node # can be used as an index into a data structure • The algorithm can use two arrays, D & R – each indexed by the node # – The ith entry in array D stores a current value of the minimum distance from the source to node i – The ith entry in array R stores the next hop used to reach node i along the path being computed – The set S can be maintained as a doubly linked list of node #s • which facilitates searching the entire set or deleting an entry Ali Kujoory 6/30/2016 Not to be reproduced without permission 67 18.13 Shortest Paths & Weights • Algorithm 18.2 uses weight (i, j) as a function – that returns the weight of the edge from node i to node j • Function weight is assumed to return a reserved value infinity if no edge exists from node i to node j – In practice, any value can be used to represent infinity provided the value is larger than the sum of weights along any path in the graph Ali Kujoory 6/30/2016 – One way to generate a value infinity consists of adding one to the sum of all weights on all edges • Allowing arbitrary weights to be assigned to edges of a graph means that – one algorithm can be used with different measures of distance – E.g., some WAN technologies measure distance by counting the # of packet switches along a path Not to be reproduced without permission 68 18.13 Shortest Paths & Weights • To use the algorithm for such technologies • the other designated to be a backup path • To enforce such a policy – each edge in the graph is assigned a weight of 1 • In other WAN technologies, weights are assigned to reflect the capacity of the underlying connections – A network manager can assign weights to links to control routing – E.g., consider a case where two separate paths exist between a pair of packet switches with – a network manager can assign the primary link a low weight & the other link a high weight – Routing software will configure forwarding tables to use the path with low weight • unless the path is not available • in which case routing software will select the alternative path • one path designated to be the primary path & Ali Kujoory 6/30/2016 Not to be reproduced without permission 69 18.14 Routing Problems • In theory, either LSR or DVR routing will compute shortest paths • Furthermore, each approach will eventually converge – meaning that the forwarding tables in all packet switches agree • However, problems do occur – E.g., if LSR messages are lost, two packet switches can disagree about the shortest path Ali Kujoory 6/30/2016 • DVR problems can be more severe – because a link failure can cause two or more packet switches to create a routing loop • in which each packet switch thinks the next packet switch in the set is the shortest path to a particular destination • As a result, a packet can circulate among the switches indefinitely Not to be reproduced without permission 70 The Count-to-Infinity Problem • Distance Vector Routing converges slowly • Routing loops can occur when there is invalid update due to a failure • Then A comes up – After 1st exchange B learns A is 1 hop away; others think A is still down – After 2nd exchange, C learns A is 2 hops away; D & E think A is down – In this case, the Distance-Vector is incremented to a big #, Count-to-infinity • In (a), initially A is down, other routers know it (delay to A=infinity) • Need N exchanges for a path of N hops • In (b) A is initially up & then goes down; Count-to-infinity occurs The delay metric = number of hops After A comes back B is one hop from A. B thinks it can go to A via C! Ali Kujoory 6/30/2016 Not to be reproduced without permission 71 18.14 Routing Problems • One of the primary reasons DVR protocols exhibit problems comes from backwash, i.e., – a packet switch receives information that it sent • E.g., suppose a switch tells its neighbors “I can reach destination D at cost 3” – If the connection leading to destination D fails • Imagine that just after the link fails – one of the neighbors sends a DVR message that specifies “I can reach destination D at cost 4” • Unfortunately – the message will be believed & – a routing loop will be created • the switch will remove the entry for D from its forwarding table, or ⌐ mark the entry invalid – But the switch has told neighbors that a route exists Ali Kujoory 6/30/2016 Not to be reproduced without permission 72 18.14 Routing Problems • Most practical routing mechanisms contain constraints & heuristics (by try & error) to prevent problems like routing loops • E.g., DVR schemes employ split horizon – which specifies that a switch does not send information back to its origin • Furthermore, most practical routing systems introduce hysteresis (lag in effect) – that prevents the software from making many changes in a short time • However, in a large network where many links fail & recover frequently, routing problems can occur Ali Kujoory 6/30/2016 Not to be reproduced without permission 73 Distance-vector versus Link-state Distance Vector Link-State Views net topology from Gets common view of entire neighbor’s perspective network topology Adds distance vectors from router to router Frequent, periodic updates - slow convergence Passes copies of routing table to neighbor routers Calculates the shortest path to other routers Event-triggered updates - faster convergence Passes link-state routing updates to other routers Requires relatively less memory Requires more memory / processing / processing for handling routing tables Used for smaller to medium size Used for very large network (e.g., networks Ali Kujoory Internet) - cheaper 6/30/2016 Not to be reproduced without permission 74