400 likes | 477 Views
Routing Basics What’s going on the back …. Faisal Karim Shaikh faisal.shaikh@faculty.muet.edu.pk DEWSNet Group Dependable Embedded Wired/Wireless Networks www.fkshaikh.com/dewsnet. Main function of Network Layer is ??????? In most cases packet requires multiple hops to make journey.
E N D
Routing BasicsWhat’s going on the back … Faisal KarimShaikh faisal.shaikh@faculty.muet.edu.pk DEWSNet Group Dependable Embedded Wired/Wireless Networks www.fkshaikh.com/dewsnet
Main function of Network Layer is • ??????? • In most cases packet requires multiple hops to make journey. • The algorithms that chooses the routes is major area of Network layer design.
Properties for desirable Routing Algorithms • Correctness • Simplicity • Robustness • Stability • Fairness • Optimality
Performance Criteria • used for selection of route • simplest is “minimum hop” • can be generalized as “least cost”
Decision Time and Place • time • packet or virtual circuit basis • fixed or dynamically changing • place • distributed - made by each node • centralized • source
Network Information Source and Update Timing • routing decisions usually based on knowledge of network (not always) • distributed routing • using local knowledge, info from adjacent nodes, info from all nodes on a potential route • central routing • collect info from all nodes • issue of update timing • when is network info held by nodes updated • fixed - never updated • adaptive - regular updates
Major Classes • Nonadaptive Algorithms. • Not based on measurement or estimate of current traffic and topology. • The choice of route is computed in advance. • called as Static Routing/Fixed Routing. • Adaptive Algorithms. • Change routing decisions to reflect change in topology, and traffic as well. • They differ in where they get their information, and what metric is used for optimization.
Nonadaptive Algorithms. • Direct delivery • Indirect delivery • Static routing • Default routing • Adaptive Algorithms • Distance vector routing • Link state routing
Shortest Path Routing • The idea is to build graph of subnet • Where each node rep: router and each arc communication link. • There are many ways of measuring path length • Number of hops. • Geographical distance. • Transmission delay. • Mean queuing. • Note: In general, the label on arcs could be computed as function of distance, average traffic, measured delay and other factors.
Dijkstra Algorithm B C 7 2 3 3 A 2 F D E 2 2 1 6 2 G 4 H
B(2,A) C(,-) A E (,-) F (,-) D (,-) G (6,A) H (,-)
B(2,A) C(9,B) A E (4,B) F (,-) D (,-) G (6,A) H (,-)
B(2,A) C(9,B) A E (4,B) F (6,E) D (,-) G (5,E) H (,-)
B(2,A) C(9,B) A E (4,B) F (6,E) D (,-) G (5,E) H (9,G)
B(2,A) C(9,B) A E (4,B) F (6,E) D (,-) G (5,E) H (8,F)
Dijkstra’s Algorithm Definitions • Find shortest paths from given source node to all other nodes, by developing paths in order of increasing path length • N= set of nodes in the network • s = source node • T= set of nodes so far incorporated by the algorithm • w(i, j)= link cost from node i to node j • w(i, i) = 0 • w(i, j) = if the two nodes are not directly connected • w(i, j) 0 if the two nodes are directly connected • L(n)=cost of least-cost path from node s to node n currently known • At termination, L(n) is cost of least-cost path from s to n
Dijkstra’s Algorithm Method • Step 1 [Initialization] • T = {s} Set of nodes so far incorporated consists of only source node • L(n) = w(s, n) for n ≠ s • Initial path costs to neighboring nodes are simply link costs • Step 2[Get Next Node] • Find neighboring node not in T with least-cost path from s • Incorporate node into T • Also incorporate the edge that is incident on that node and a node in T that contributes to the path • Step 3[Update Least-Cost Paths] • L(n) = min[L(n), L(x) + w(x, n)]for all nÏ T • If latter term is minimum, path from s to n is path from s to x concatenated with edge from x to n • Algorithm terminates when all nodes have been added to T
Dijkstra’s Algorithm Notes • At termination, value L(x) associated with each node x is cost (length) of least-cost path from s to x. • In addition, T defines least-cost path from s to each other node • One iteration of steps 2 and 3 adds one new node to T • Defines least cost path from s tothat node
Bellman-Ford Algorithm Definitions • Find shortest paths from given node subject to constraint that paths contain at most one link • Find the shortest paths with a constraint of paths of at most two links • And so on • s = source node • w(i, j)=link cost from node i to node j • w(i, i) = 0 • w(i, j) = if the two nodes are not directly connected • w(i, j) 0 if the two nodes are directly connected • h = maximum number of links in path at current stage of the algorithm • Lh(n)=cost of least-cost path from s to n under constraint of no more than h links
Bellman-Ford Algorithm Method • Step 1 [Initialization] • L0(n) = , for all n s • Lh(s) = 0, for all h • Step 2 [Update] • For each successive h 0 • For each n ≠ s, compute • Lh+1(n)=minj[Lh(j)+w(j,n)] • Connect n with predecessor node j that achieves minimum • Eliminate any connection of n with different predecessor node formed during an earlier iteration • Path from s to n terminates with link from j to n
Bellman-Ford Algorithm Notes • For each iteration of step 2 with h=K and for each destination node n, algorithm compares paths from s to n of length K=1 with path from previous iteration • If previous path shorter it is retained • Otherwise new path is defined
Comparison • Results from two algorithms agree • Information gathered • Bellman-Ford • Calculation for node n involves knowledge of link cost to all neighboring nodes plus total cost to each neighbor from s • Each node can maintain set of costs and paths for every other node • Can exchange information with direct neighbors • Can update costs and paths based on information from neighbors and knowledge of link costs • Dijkstra • Each node needs complete topology • Must know link costs of all links in network • Must exchange information with all other nodes
Routing Strategies - Flooding • packet sent by node to every neighbor • eventually multiple copies arrive at destination • no network info required • each packet is uniquely numbered so duplicates can be discarded • need some way to limit incessant retransmission • nodes can remember packets already forwarded to keep network load in bounds • or include a hop count in packets
Properties of Flooding • all possible routes are tried • very robust • at least one packet will have taken minimum hop count route • can be used to set up virtual circuit • all nodes are visited • useful to distribute information (eg. routing) • disadvantage is high traffic load generated
Flow Based Routing • The previous algorithms do not consider load. B C A D F E G H
Flow Based Routing (cont…) • In some networks the mean data flow b/w pair of nodes is stable and predictable. • Under these conditions, where average traffic b/w i and j is known in advance, and constant in time, it is possible to analyze flows.
Flow Based Routing (cont…) • Basic idea behind analysis is • For a given line if • Capacity • And average flow are known • It is possible to compute mean packet delay on that line by queuing theory. • The routing problem than reduces to finding the routing algorithm that produces minimum average delay for subnet.
Flow Based Routing (cont…) • Certain info must be known in advance. • Subnet topology. • Traffic matrix Fi,j • Line Capacity Matrix Ci,j • Tentative Routing algorithm must be chosen.
Routing Strategies - Random Routing • simplicity of flooding with much less load • node selects one outgoing path for retransmission of incoming packet • selection can be random or round robin • a refinement is to select outgoing path based on probability calculation • no network info needed • but a random route is typically neither least cost nor minimum hop
Dynamic Routing Algorithms • Distance Vector Routing • Link State Routing
Distance Vector Routing • Also called as • Distributed Bellman-Ford Algorithm. • Ford-Fulkerson Algorithm. • It operates by maintaining a table(vector), • Giving best known distance to destination. • Which line to use to get there. • These vectors are updated by exchanging information with neighbors.
Each router maintain the routing table indexed by, and containing one entry for each router in subnet. • Entry contain two parts: • The preferred outgoing line. • The estimate of metric to that destination. • The router is assumed to know the “distance” to each of its neighbors. • Example from Wikipedia …
Count-to-Infinity problem • Distance Vector routing works in theory. • It has serious drawbacks. • It reacts rapidly to good news. • But leisurely to bad news. • Example ???