Routing Protocols ================== * What is routing? Determining the best path to reach a destination. Routing protocols form the control plane of the network layer, and responsible for coming up with a set of routes for any destination, and for picking the best route. * Any routing protocol roughly consists of two phases: route advertisements using which information about destinations is exchanged via messages, and best route computation where a best route is chosen to be installed into the forwarding table. * What are the criteria to pick a path? Usually, intra-domain routing protocols pick the shortest cost path. Every link has a metric, and the path that minimizes the sum of all link metrics is chosen as best path. How are metrics chosen? Can be simple hop count, based on bandwidth, latency, physical distance etc. That is, based on desirability of using the link. Inter-domain routing protocols may use other criteria like policy. Network operators may also wish to balance load across links (traffic engineering). But usually, the simplest way to pick path is shortest path or least cost path. * Load-sensitive vs load-insensitive routing: most routing protocols do not pick best path based on congestion, as it can lead to oscillations and instability. That is, link metrics do not depend on current load level. For example, if some link is loaded and its metric reduces, all flows may move away from it, leading to load on another link, and all flows will move back again. * Static vs dynamic routing: for small networks and/or networks that rarely change, manually setting the route once is sufficient. This is called static routing. For more complicated networks, dynamic routing protocols are used, that adapt routes in response to changes in network topology. We will study two classes of dynamic routing protocols: link state (LS) routing protocols, and distance vector (DV) routing protocols. * Link state routing: "tell about your neighbors to everyone". Each node collects information about all its neighbors and the link metrics. This LSA (link state announcement) of every node is flooded through the entire network. So, at the end of it, each node has complete view of the network graph. Each node then independently runs Dijkstra's shortest path algorithm to get the shortest path to every destination, based on which it figures out the next hop for every destination. * Suppose a node u has obtained LSA of all nodes in the network. This is the algorithm that u runs to find shortest path to all destinations. Let N = set of all nodes Let D(x) = distance to x from source node u Let c(x,y) denote the cost of the edge from x to y Let prev(v) denote the previous node on the shortest path from source node u to v Initially, let N' = {u} For all nodes v that are neighbors of u, D(v) = c(u,v) For all other nodes D(v) = infinity Now, we will run the following loop. Each iteration of the loop adds one node to N', and the loop terminates when N' = N. Loop: Find w not in N' that has the least D(w) and add to N' For each neighbor v of w that is not in N': if(D(w) + c(w,v) < D(v)) D(v) = D(w) + c(w,v) prev(v) = w * What is the above update rule doing? If u has a shorter path to v via w than what it had before, then the path via w is used by u as the shortest path to v. Node v stores its previous hop as w, and the complete shortest path from u to any node can be found by tracing the previous pointers. * Distance vector routing: "tell about everyone to your neighbors". Every node exchanges a distance vector (a vector containing its estimate of distance to each destination) with its neighbors. Upon receiving a neighbor's distance vector, a node updates its distance vector by adding its link cost to neighbor's distance vector, and if a better path is found through neighbor, it updates its best route. This is called the Bellman-Ford update algorithm. * In DV, every node maintains a distance vector D, which lists its estimate of the distance to all destinations. Initially, at a source node x, D(y) = c(x,y) for directly connected neighbors, and D(y) = infinity for all other y. Node x now obtains a distance vector Dv from every neighbor v, and updates its distance vector as follows. D(y) = min over all v { c(x,v) + Dv(y) } * Distance vector has "count to infinity" problem. Suppose node A has a path to a destination and B is using the path via A. Now if A's path fails, A might mistakenly use B's distance vector and start using B's path (which goes via A) leading to routing loops and invalid paths. Simple solution is "split horizon" or "poisoned reverse": if B is using the path via A, then B will announce a distance vector of infinity to A for that particular destination. * LS vs DV: LS has higher messaging complexity but converges faster to the correct path. * OSPF (Open Shortest Paths First) is a popular intra-domain routing protocols that uses simple LS routing logic. RIP (Routing Information Protocol) is a simple DV protocol. * Work out examples of LS and DV routing protocols in action.