Last lecture - link-state routing Today - distance-vector routing (distributed Bellman-Ford algorithm) Assumptions in distance-vector routing protocol - each knows the ID of every other router (but not necessarily the shortest path to it). - each router maintains a distance vector, i.e., a list of tuples, one tuple per destination, where cost is the current estimate for the sum of the link costs on the shortest path to that destination. How the algorithm works: a) each router initializes the cost to reach all nonneighbor nodes to infinity b) when a router receives a distance vector from a neighbor, it determines whether its cost to reach any destination would decrease if it routed packets to that destination through that neighbor. It can be shown (can you prove it?) that even if nodes asynchronously update their distance vectors, the routing tables will eventually converge. Intuition: each router knows the true cost to its neightbors. This information is spread one hop with the first exchange of distance vectors, and one hop further on each subsequent exchange. The cost of every link is eventually known throughout the network. Example: B |\ 3| \ E --A--C---D |5 | | | F------G Each node maintains a table: A's table C's table Destination NextHop Cost Destination NextHop Cost B B 3 A A 1 C C 1 B B 1 D x inf D D 1 E E 1 E x inf F F 5 F x inf G x inf G x inf A and C exchange information, Node A recompute the cost function =========================== foreach destination X if NextHop(A, X) == C cost(A, X) = cost (A, C) + cost (C, X) else if cost(A, X) > cost (A, C) + cost (C, X) cost(A, X) = cost (A, C) + cost (C, X); NextHop(A, X) = C; New Table ============ A's table C's table Destination NextHop Cost Destination NextHop Cost B B 3 A A 1 C C 1 B B 1 D C 2 D D 1 E E 1 E A 2 F F 5 F A 2 G x inf G x inf When to update? - something happens ==> a new link or a dead link - periodically What is a good cost function? - hop count - load dependent Example: ======= link between F and G is down events: (1) F sets cost to G to inf (2) F propagates information to A (3) A sets cost to G to inf (4) C propagates information to A (5) A sets cost to G to 3, and nextHop to be C (6) A propagates information to F, F sets cost to G to 4, nextHop to be A Count-to-infinity problem associated with distance-vector routing Another example ================ link between A and E is down events: (1) F tells A that it has a path to E with cost 6 (2) A sets cost to E to be 11, and advertise to F again (3) F sets the cost to E to be 16, and advertise to A again This cycle will continue and the cost to E goes to infinity --> slow convergence. During this process of counting to infinity, packets from A or F destined to E are likely to loop back and forth between A and F, causing congestion for other packets. Partial Solution: Split Horizon - a router never advertises the cost of a destination to its neighbor N, if N is the next hop to that destination. - only solves the problem when two adjacent routers count to infinity: it is ineffective when 3 routers mutually do so. Better solution: Path Vector - add path information to the distance vector, by labeling each entry in the distance vector with the path used to obtain this cost. - In the above example where the link between A and E is down, F tells A that the its cost to E is 6, and the path to E was F-A-E. When A sees this, it realizes that no route to E exists, and the count-to-infinity problem goes away. The path-vector solution is used in the border gateway protocol (BGP). Summary =========== Distance Vector (Distributed Bellman-Ford algorithm) + simple +/- fully distributed state ==> no one knows the full topology + good news travel fast (new link) - bad news travel slow (down link)