CS4450 Computer Networks: Architecture and Protocols Lecture 11 Rou+ng: Deep Dive Spring 2018 Rachit Agarwal
2 Goals for Today s Lecture Learning about Routing Protocols Link State (Global view) Distance Vector (Local view) Maintain sanity: its one of the harder lectures I ll try to make it -less- hard, but Pay attention Review again tomorrow Work out a few examples
3 Recap: Spanning Tree Protocol (failures on later slides) Messages (Y,d,X): For root Y; From node X; advertising a distance d to Y Initially each switch X announces (X,0,X) to its neighbors Switches update their view Upon receiving message (Y,d,Y) from Z, check Y s id If Y s id < current root: set root = Y Switches compute their distance from the root Add 1 to the shortest distance received from a neighbor If root changed OR shortest distance to the root changed, send all neighbors updated message (Y,d+1,X)
Recap: Routing via Flooding on Spanning Tree Easy to design routing algorithms for trees Nodes can flood packet to all other nodes Amazing properties: No routing tables needed! No packets will ever loop. At least (and exactly) one packet must reach the destination Assuming no failures Three fundamental issues: Unnecessary processing at end hosts (that are not the destination) Higher latency Lower available bandwidth
Recap: Routing via Routing Tables Suppose packet follows Path 1: Cornell - S#1 - S#3 - MIT DESTINATION NEXT HOP CORNELL MIT HARVARD L1 L3 L4 Switch #1 L4 Harvard L1 L2 L3 Switch #3 DESTINATION CORNELL NEXT HOP L5 MIT L6 Cornell HARVARD L3 L5 L6 DESTINATION CORNELL NEXT HOP L2 Switch #2 MIT L5 HARVARD L5 MIT Each Switch stores a table indicating the next hop for corresponding destination of a packet (called a routing table)
Recap: Routing Tables Routing state: collection of routing tables across all nodes Two questions: How can we verify given routing state is valid? How can we produce valid routing state? Last lecture: global routing state valid if and only if: There are no dead ends (other than destination) There are no loops Today: How to produce valid routing state?
Questions?
Producing Valid Routing State Easy to avoid dead ends Avoiding loops is hard The key difference between routing protocols is how they avoid loops!
Four flavors of protocols Create Tree, route on tree E.g., Spanning tree protocol (switched Ethernet) Good: easy, no (persistent) loops, no dead ends Not-so-good: unnecessary processing, high latency, low bandwidth Obtain a global view: E.g., Link state (today) Distributed route computation: E.g., Distance vector E.g., Border Gateway Protocol We will try to finish Link state and Distance vector today
Routing Metrics Routing goals: compute paths with minimum X X = number of hops (nodes in the middle) X = latency X = weight X = failure probability Generally assume every link has cost associated with it We want to minimize the cost of the entire path We will focus on a subset of properties X, where: Cost of a path = sum of costs of individual links/nodes on the path E.g., number of hops and latency
Global view
Two Aspects of Global View Method Protocol: What we focus on today Where to create global view How to create global view Disseminating route computation (if necessary) When to run route computation Algorithm: computing loop-free paths on graph Straightforward to compute lowest cost paths Using Dijkstra s algorithm (please study; algorithms course) We won t spend time on this
Where to create global view? One option: Central server Collects a global view Computes the routing table for each node Installs routing tables at each node Software-defined Networks: later in course Second option: At each router Each router collects a global view Computes its own routing table using Link-state protocol Link-state routing protocol OSPF is a specific implementation of link-state protocol IETF RFC 2328 (IPv4) or 5340 (IPv6)
Overview of Link-State Routing Every router knows its local link state Knows state of links to neighbors Up/down, and associated cost A router floods its link state to all other routers Uses a special packet Link State Announcements (LSA) Announcement is delivered to all nodes (next slide) Hence, every router learns the entire network graph Runs route computation locally Computing least cost paths from them to all other nodes E.g., using Dijkstra s algorithm
How does Flooding Work? Link state announcement (LSA) arrives on a link at a router That router: Remembers the packet Forwards the packet out all other links Does not send it out the incoming link Why? If a previously received announcement arrives again Router drops it (no need to forward again)
Link-State Routing Host B Host A Host C S2 S1 S3 S4 S5 S7 Host E S6 Host D
Each Node Then has a Global View Host B Host A Host C S2 S1 S3 S4 S5 S7 Host E S6 Host D
When to Initiate Flooding of announcements? Topology change Link failures Link recovery Configuration change Link cost change (why would one change link cost?) Periodically Refresh the link-state information Typically (say) 30 minutes Corrects for possible corruption of data
Making Floods Reliable Reliable Flooding Ensure all nodes receive same link state announcements No announcements dropped Ensure all nodes use the latest version Suppose we can implement reliable flooding. How can it still fail? Can you ever have loops with link-state routing? Again: Can you ever have loops with link-state routing?
Are Loops Still Possible? 5 5 5 3 5 5 1 1 A D E F C B 5 5 5 3 5 5 1 A D E F C B A and D think this is the path to C E-C link fails, but D doesn t know yet E thinks that this the path to C E reaches C via D, D reaches C via E Loop!
Transient Disruptions 5 5 5 3 5 5 1 A D E F C B 5 5 5 3 5 5 1 A D E F C B Inconsistent link-state views Some routers know about failure before others The shortest paths are no longer consistent Can cause transient forwarding loops Transient loops are still a problem!
Convergence All routers have consistent routing information E.g., all nodes having the same link-state database Forwarding is consistent after convergence All nodes have the same link-state database All nodes forward packets on same paths But while still converging, bad things can happen
Time to Reach Convergence Sources of convergence delay? Time to detect failure Time to flood link-state information (~longest RTT) Time to recompute forwarding tables Performance problems during convergence period? Dead ends Looping packets And some more we ll see later.
Link State is Conceptually Simple Everyone floods links information Everyone then knows graph of the network Everyone independently computes paths on the graph All the complexity is in the details
Distributed Route Computation
Distributed Computation of Routes Each node computing the outgoing links based on: Local link costs Information advertised by neighbors Algorithms differ in what these exchanges contain Distance-vector: just the distance (and next hop) to each destination Path vector: the entire path to each destination We will focus on distance-vector for now
Recall: Routing Tables = Collection of Spanning Trees Can we use the spanning tree protocol (with modifications)? Messages (Y,d,X): For root Y; From node X; advertising a distance d to Y Initially each switch X announces (X,0,X) to its neighbors For destination X: each switch Z announces (X,d_x, Z) to its neighbors Switches update their view Upon receiving message (Y,d,Y) from Z, check Y s id If Y s id < current root: set root destination = Y Switches compute their shortest distance from the root destination Add link cost c to the shortest distance received from a neighbor If root changed OR shortest distance to the root destination changed, send all neighbors updated message 27(Y,d+c,X)
28 Lets focus on one destination = Z first Messages (Y,d,X): For root Y; From node X; advertising a distance d to Y Initially each switch Z announces (Z,0,Z) to its neighbors Switches update their view Upon receiving message (Z,d,Y) from Y, check Y s id If Y s id < current root: set root destination = Z Switches compute their shortest distance from the root destination Add link cost c to the shortest distance received from a neighbor If root changed OR shortest distance to the root destination changed, send all neighbors updated message (Z,d+c,X)
Group Exercise: Lets run the Protocol on this example (destination = 1)
Round 1 Receive Send 1 (1, 0, 1) 2 3 4 5 6 7
Round 2 Receive Send 1 (1, 0, 1) 2 3 (1, 0, 1) (1, 1, 3) 4 5 (1, 0, 1) (1, 1, 5) 6 (1, 0, 1) (1, 1, 6) 7
Round 3 Receive Send 1 (1, 0, 1) (1, 1, 3), (1, 1, 5), (1, 1, 6) 2 (1, 1, 3), (1, 1, 6) (1, 2, 2) 3 (1, 1, 3) 4 5 (1, 1, 5) (1, 1, 6) 6 (1, 1, 6) (1, 1, 5) 7
Round 4 Receive Send 1 (1, 0, 1) 2 (1, 2, 2) 3 (1, 1, 3) (1, 2, 2) 4 (1, 2, 2) (1, 3, 4) 5 (1, 1, 5) 6 (1, 1, 6) (1, 2, 2) 7 (1, 2, 2) (1, 3, 7)
Round 5 Receive Send 1 (1, 0, 1) 2 (1, 2, 2) (1, 3, 4), (1, 3, 7) 3 (1, 1, 3) 4 (1, 3, 4) (1, 3, 7) 5 (1, 1, 5) 6 (1, 1, 6) 7 (1, 3, 7) (1, 3, 4)
Group Exercise: Lets run the Protocol on this example (destination = 2)
Why not Spanning Tree Protocol? Why Distance Vector? The same algorithm applies to all destinations Each node announces distance to each dest I am 4 hops away from node A I am 6 hops away from node B I am 3 hops away from node C Nodes are exchanging a vector of distances
37 Lets see Messages (Y,d,X): For root Y; From node X; advertising a distance d to Y Initially each switch X announces (X,0,X) to its neighbors For destination X: each switch Z announces (X,d_x, Z) to its neighbors Switches update their view Upon receiving message (Y,d,Y) from Z, check Y s id If Y s id < current root: set root destination = Y Switches compute their shortest distance from the root destination Add link cost c to the shortest distance received from a neighbor If root changed OR shortest distance to the root destination changed, send all neighbors updated message (Y,d+c,X)
Two Aspects to This Approach Protocol: Exchanging that routing information with neighbors What and when for exchanges RIP is a protocol that implements DV (IETF RFC 2080) Algorithm: How to use the information from your neighbors to update your own routing tables?
General Approach to Algorithm Assume link between nodes x,y has cost c(x,y) Node u finds minimal cost paths using the following 1.Neighbors tell me their distance to all nodes v Each neighbor w gives me a distance vector d(w,v) for all v Distance means total cost over path 2.Node u s cost to a given destination v is then: d(u,v) = Min_{nbrs w} [c(u,w) + d(w,v)] 3.Node u tells neighbors about d(u,v) and process repeats
Three Node Network from to x y z x 0 2 7 y 2 0 1 z 7 1 0 y 2 1 x 7 z d(x,z) = min { cost (x,z), cost (x,y) + d(y,z)}
Three Node Network from to x y z x 0 2 3 y 2 0 1 z 7 1 0 y 2 1 x 7 z d(x,z) = min { cost (x,z), cost (x,y) + d(y,z)}
More Generally y 2 x 7 u z 1 w d(x,z) = min { cost (x,y) + d(y,z), cost (x,u) + d(u,z), cost (x,w) + d(w,z) } Bellman Ford equation
From Algorithm to Protocol Algorithm: Nodes use Bellman-Ford to compute distances Protocol Nodes exchange distance vectors Update their own routing tables And exchange again Details: when to exchange, what to exchange, etc.
Three Node Network This is y s distance vector x y z x - - - y 2 0 1 z - - - y 2 1 from x to x y z x 0 2 7 y - - - z - - - 7 z x y z x - - - y - - - z 7 1 0
Three Node Network x y z This is y s distance vector x y 0 2 2 0 7 1 z 7 1 0 y 2 1 from x to x y z x 0 2 7 y z 7 x y z x y z 0 2 7 2 0 1 z 7 1 0
Three Node Network This is y s distance vector x y z x y 0 2 2 0 7 1 z 7 1 0 y 2 1 from x to x y z x 0 2 3 y 2 0 1 z 7 1 0 7 x y z x y z 0 2 7 2 0 1 z 7 1 0
Three Node Network This is y s distance vector x y z x y 0 2 2 0 3 1 z 3 1 0 y 2 1 from x to x y z x 0 2 3 y 2 0 1 z 3 1 0 7 x y z x y z 0 2 3 2 0 1 z 3 1 0
A More Complicated Case The three node network: Everyone was neighbors with everyone else What happens in a larger network? I will show you a graph Work out first few steps yourself Then we can go over them together
Four Node Network x y v z x y 1 0 3 z y 3 z x y v z y v z 3 1 0 1 1 x 2 v x y v z x 0 1 2 y v x y v z x v 2 0 1 z
After First Exchange x y v z x 0 1 2 y 1 0 3 z 3 1 0 y 3 z x y v z y 1 0 3 v 2 0 1 z 3 1 0 1 1 x 2 v x y v z x 0 1 2 y 1 0 3 v 2 0 1 x y v z x 0 1 2 v 2 0 1 z 3 1 0
Recomputing Tables x y v z x 0 1 2 3 y 1 0 3 3 z 3 3 1 0 y 3 z x y v z y 1 0 3 3 v 2 3 0 1 z 3 3 1 0 1 1 x 2 v x y v z x 0 1 2 3 y 1 0 3 3 v 2 3 0 1 x y v z x 0 1 2 3 v 2 3 0 1 z 3 3 1 0
Do This One Yourself x y v z x y 7 0 3 z y 3 z x y v z y v z 3 1 0 7 1 x 2 v x y v z x 0 7 2 y v x y v z x v 2 0 1 z
Answers x y v z x 0 6 2 3 y 6 0 4 3 z 3 3 1 0 y 3 z x y v z y 6 0 4 3 v 2 4 0 1 z 3 3 1 0 7 1 x 2 v x y v z x 0 6 2 3 y 6 0 4 3 v 2 4 0 1 x y v z x 0 6 2 3 v 2 4 0 1 z 3 3 1 0
Other Aspects of Protocol When do you send messages? When any of your distances d(u,v) change What about when c(u,v) changes Periodically, to ensure consistency between neighbors What information do you send? Could send entire vector Or just updated entries Do you send everyone the same information Consider the following slides
Three Node Network x y z y z 24 0 1 3 1 0 routing loop! y 2 1 x 7 z x y z What happens now? y z 24 0 1 3 1 0
Three Node Network x y z y 46 8 0 1 z 35 7 1 0 routing loop! y 1 x Count to infinity scenario 7 z x y z if c(x,z) was infinite y 46 8 0 1 z 35 7 1 0
How Can You Fix This? Why would you advertise a path back to the person who has advised it to you? Telling them about your entry going through them Doesn t tell them anything new Perhaps misleads them that you have an independent path Solution: if you are using a next-hop s path, then: Tell them not to use your path (by telling them cost of \inf) Called poisoned reverse And it is easy to get them confused
Three Node Network Poisoned reverse y x y z 28 0 1 z 7 1 0 y 2 1 x 7 z x y z Poisoned reverse y z 2 0 1 37 1 0
Convergence Distance vector protocols can converge slowly While these corner cases are rare The resulting convergence delays can be significant
More Complete Version of Protocol Send distance vectors based on timers: Every so often send complete DV to your neighbors Follow split horizon rule: If use neighbor for path to x, don t send a routing entry for x to the neighbor When any values in your DV change, send updates Only send elements that changed Special cases: Poisoning the route: send when no longer have path Poison reverse: send to neighbor you go through for path
Three Node Network x y z Poisoning route Poisoned reverse y 0 1 z 1 0 y 1 x 7 z
Poisoning, Split Horizon, etc. Poisoning and split horizon have similar goals But they are used in different contexts And it is easy to get them confused
Split Horizon: When and Why Split horizon only works when sending full updates Silence about route is interpreted as lack of route Which only makes sense when sending full update If always send full updates, no need for poison Lack of route to destination has clear meaning Don t send those packets to me! Could be because I have no route, or because O have a route through you
Poison: What and Why Poison necessary when sending partial updates Silence with partial updates means no change It does not mean no route Must explicitly tell neighbors not to use route Poisoning a route: telling the truth about absence of path Poison reverse: have a path, but lie about it since it gets through that neighbor But only have to poison if you have ever advertised that route!
Why Use Split Horizon At All? Why not always poisoning? No possible confusion Very clear implementation Consider the case of Berkeley s edge router Does it want to advertise all routes in the universe to the next-hop external router All of these paths (except Berkeley destinations) always go through that router Easier and more efficient to just be silent about them You never advertise these routes, so you never have to poison
Example in Real Life If I post a new lecture schedule, and it contains no midterm, you know that there is no midterm If I post a small change to the lecture schedule, the fact that I do not mention a midterm does not imply that there is no midterm Would have to explicitly say the midterm was cancelled But if I ve never mentioned midterms in my full schedule, you can assume that there is still no midterm if I make a minor change to my schedule
Path Vector When advertise to neighbors, send them your paths Why this might be helpful? This prevents loops, even when not minimizing metric Loop prevention is now separate from routing goal What foals might this accommodate? Policy choices
What Might Go Wrong With PV? Every router can make its own decisions about: Which of its neighbors paths to use (if any) Which of its paths to tell each neighbor (if any) What could go wrong with such an algorithm? Go talk to your friends for a few minutes Then I ll ask for volunteers
Possible Issues Lack of connectivity If Berkeley refuses to use routes from Stanford, might not be able to reach some places in the Internet Lack of convergence: The routing algorithm is not guaranteed to converge Will discuss this when we get to inter domain routing
Comparison of Scalability Link-State: Global flood: each router s link-state (#ports) Send it once per link event, or periodically Distance Vector: Send longer vector (#dest) just to neighbors But might end up triggering their updates Send it every time DV changes (which can be often) Tradeoff: LS: Send it everywhere and be done in predictable time DV: Send locally, and perhaps iterate until convergence