Download presentation
Presentation is loading. Please wait.
Published byRaegan Crawley Modified over 9 years ago
1
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
2
Local Area Networks 2 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.
3
Local Area Networks 3 Properties for desirable Routing Algorithms Correctness Simplicity Robustness Stability Fairness Optimality
4
Local Area Networks 4 Performance Criteria used for selection of route simplest is “minimum hop” can be generalized as “least cost”
5
Local Area Networks 5 Decision Time and Place time packet or virtual circuit basis fixed or dynamically changing place distributed - made by each node centralized source
6
Local Area Networks 6 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 routeusing local knowledge, info from adjacent nodes, info from all nodes on a potential route central routing collect info from all nodescollect info from all nodes issue of update timing when is network info held by nodes updated fixed - never updated adaptive - regular updates
7
Local Area Networks 7 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.
8
Local Area Networks 8 Nonadaptive Algorithms. Direct delivery Indirect delivery Static routing Default routing Adaptive Algorithms Distance vector routing Link state routing
9
Local Area Networks 9 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.
10
Local Area Networks 10 A D H F CB E G 3 2 3 2 7 6 2 2 1 2 4 Dijkstra Algorithm
11
Local Area Networks 11 A D ( ,-) F ( ,-) C( ,-)B(2,A) E ( ,-) G (6,A) H ( ,-)
12
Local Area Networks 12 A D ( ,-) F ( ,-) C(9,B)B(2,A) E (4,B) G (6,A) H ( ,-)
13
Local Area Networks 13 A D ( ,-) F (6,E) C(9,B)B(2,A) E (4,B) G (5,E) H ( ,-)
14
Local Area Networks 14 A D ( ,-) F (6,E) C(9,B)B(2,A) E (4,B) G (5,E) H (9,G)
15
Local Area Networks 15 A D ( ,-) F (6,E) C(9,B)B(2,A) E (4,B) G (5,E) H (8,F)
16
Local Area Networks 16 Bellman-Ford Algorithm ???
17
Local Area Networks 17 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
18
Local Area Networks 18 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
19
Local Area Networks 19 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
20
Local Area Networks 20 Example of Dijkstra’s Algorithm
21
Local Area Networks 21 Results of Example Dijkstra’s Algorithm Ite rat ion TL(2)PathL(3)PathL(4)PathL(5)PathL(6 ) Path 1{1}21–251-311–4 - - 2{1,4}21–241-4-311–421-4–5 - 3{1, 2, 4}21–241-4-311–421-4–5 - 4{1, 2, 4, 5} 21–231-4-5–311–421-4–541-4-5–6 5{1, 2, 3, 4, 5} 21–231-4-5–311–421-4–541-4-5–6 6{1, 2, 3, 4, 5, 6} 21-231-4-5-311-421-4–541-4-5-6
22
Local Area Networks 22 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 L h (n) = cost of least-cost path from s to n under constraint of no more than h links
23
Local Area Networks 23 Bellman-Ford Algorithm Method Step 1 [Initialization] L 0 (n) = , for all n s L h (s) = 0, for all h Step 2 [Update] For each successive h 0 For each n ≠ s, compute L h+1 (n)= min j [L h (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
24
Local Area Networks 24 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
25
Local Area Networks 25 Example of Bellman-Ford Algorithm
26
Local Area Networks 26 Results of Bellman-Ford Example hL h (2)PathL h (3)PathL h (4)PathL h (5)PathL h (6)Path 0 - - - - - 121-251-311-4 - - 221-241-4-311-421-4-5101-3-6 321-231-4-5-311-421-4-541-4-5-6 421-231-4-5-311-421-4-541-4-5-6
27
Local Area Networks 27 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 sCalculation 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 nodeEach node can maintain set of costs and paths for every other node Can exchange information with direct neighborsCan exchange information with direct neighbors Can update costs and paths based on information from neighbors and knowledge of link costsCan update costs and paths based on information from neighbors and knowledge of link costs Dijkstra Each node needs complete topologyEach node needs complete topology Must know link costs of all links in networkMust know link costs of all links in network Must exchange information with all other nodesMust exchange information with all other nodes
28
Local Area Networks 28 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
29
Local Area Networks 29 Flooding Example
30
Local Area Networks 30 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
31
Local Area Networks 31 Flow Based Routing The previous algorithms do not consider load. A D H F CB E G
32
Local Area Networks 32 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.
33
Local Area Networks 33 Flow Based Routing (cont…) Basic idea behind analysis is For a given line ifFor 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.
34
Local Area Networks 34 Flow Based Routing (cont…) Certain info must be known in advance. Subnet topology.Subnet topology. Traffic matrix F i,jTraffic matrix F i,j Line Capacity Matrix C i,jLine Capacity Matrix C i,j Tentative Routing algorithm must be chosen.Tentative Routing algorithm must be chosen.
35
Local Area Networks 35 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
36
Local Area Networks 36 Dynamic Routing Algorithms Distance Vector Routing Link State Routing
37
Local Area Networks 37 Distance Vector Routing Also called as Distributed Bellman-Ford Algorithm.Distributed Bellman-Ford Algorithm. Ford-Fulkerson 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.
38
Local Area Networks 38 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 …
39
Local Area Networks 39 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 ???
40
Local Area Networks 40 Link State Routing ????
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.