recitation 6e
DESCRIPTION
eeTRANSCRIPT
-
Recitation 6: Routing on the Internet
Hung-Bin (Bing) Chang and Yu-Yu Lin
Electrical Engineering Department University of California (UCLA), USA,[email protected] and [email protected]
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 1 / 15
-
Outline
1 Introduction
2 Distance Vector Routing
3 Link State RoutingDijkstras Algorithm
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 2 / 15
-
Introduction
Routing on the Internet
DefinitionIn its simplest terms, routing is choosing a path over which datapackets will be sent. On the internet, this function is performed bylayer 3 (IP) of the OSI model.Each router attaches to two or more physical networks andforwards IP datagrams among them.Except for destinations on directly attached networks, hosts pass allIP datagrams to routers which will forward them to their finaldestinations.
Two main classes of routing algorithms:Distance vector routingLink state routing (or called shortest path first, SPF)
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 3 / 15
-
Distance Vector Routing
Distance Vector Routing
When a router boots up, it initializes its routing table to contain anentry for each directly connected network.When a report arrives at router K from router J, K examines theset of destinations reported and the distance to each.
If J knows a shorter way to a destination, or if J lists a destinationthat K does not have in its table, K replaces its table entry.
Bellman-Ford algorithm.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 4 / 15
-
Distance Vector Routing
Distance Vector Routing - Contd
The process of interchanging information between neighboringrouters continues until convergence is achieved.Advantages:
Because routers do not need to maintain the state of all links in thenetwork, it typically consumes less overhead at the expense oflimited visibility.
Disadvantages:Does not scale well to large networks (volume of informationexchange can be huge)Slow response time
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 5 / 15
-
Link State Routing
Link State (Shortest Path First, SPF) Routing
Algorithm requires each participating router to have completetopology information.The easiest way to think of the topology information is to imaginethat every router has a map that shows all other routers and thenetworks to which they connect.Instead of sending messages that contain lists of destinations, arouter participating in an SPF algorithm performs two tasks:
Actively tests the status of neighboring routersIt periodically propagates link status information to all neighboringrouters.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 6 / 15
-
Link State Routing
SPF Routing - Contd
A status message does NOT specify routes, it simply reportswhether communication is possible between pairs of routersWhenever a link status message arrives, a router uses theinformation to update its map of the network by marking links asup or down.Whenever link status changes, the router re-computes routesusing the well-known Dijkstras Algorithm.Advantages:
Routers perform route computation locally guaranteed to converge.Disadvantage:
Maintaining link-state information for the entire area typicallyrequires much overhead.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 7 / 15
-
Link State Routing Dijkstras Algorithm
Dijkstras Algorithm - Introduction
The communication network can be modeled as a graph.The nodes of the graph are the routers.The edges of the graph represent a link.Each communication link is assigned a weight. A weightrepresents parameters such as:
Physical distance = Shortest pathCost = Cheapest pathQueueing delay (congestion level) = Fastest path
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 8 / 15
-
Link State Routing Dijkstras Algorithm
Dijkstras Algorithm - Problem Statement
Problem: Given a source node, find the path with the least weightto every node in the graph.Notations
w(i , j) = weight associated with edge (i , j)d(i , j) = distance from node i to node j
We pick a node to be our source node. We want to find theshortest path from our source node to destination nodes.Each node (other than source node) is associated with two labels:
Preceding node on the shortest path to the sourceDistance to the source
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 9 / 15
-
Link State Routing Dijkstras Algorithm
Dijkstras Algorithm - Some Definitions
The algorithm labels nodes as either permanent (P) set ortemporary (T ) set.
When a node is labeled as temporary (T ) set, it is tentative. Thepreceding node and distance to the source are only estimates.When a node is labeled as permanent (P) set, the preceding nodeand distance to the source are the true final values.The algorithm then proceeds to select the least cost edgeconnecting a node with a permanent label to a node with atemporary label.
Notations:
h(i, j) =
w(i, j) , if i and j are directly connected by an edge,
0 , if i = j ,
+ , otherwise.
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 10 / 15
-
Link State Routing Dijkstras Algorithm
Dijkstras Algorithm
Step 1:Set P = {1} (i.e., Node 1 is the source node)Set T = {2, 3, . . . }j = 2, 3, . . . , set d(1, j) = h(1, j)
Step 2: Find i T where d(1, i) = minjT{d(1, j)}.Set T = T {i}Set P = P + {i}If T = , it is done!
Step 3: j T :d(1, j) = min{d(1, j),d(1, i) + h(i , j)}Go to step 2
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 11 / 15
-
Link State Routing Dijkstras Algorithm
Example 1
Step 1:
P = {1}T = {2, 3, 4}d(1, 2) = 3,d(1, 4) =0.5,d(1, 3) =
Step 2:
i = 4P = {1, 4},T = {2, 3}d(1, 2) = min{3, 0.5 +} =3d(1, 3) = min{, 0.5 + 8} =8.5
3 4
80.5
2
1
4
3
3 4
80.5
2
1
4
3
(1, 3)
(1, 0.5)
(1, )
3 4
80.5
2
1
4
3
(1, 3)
(1, 0.5)
(4, 8.5)
Step 1
Step 2
Figure : Dijkstras algorithm
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 12 / 15
-
Link State Routing Dijkstras Algorithm
Example 1 - Contd
Step 3:
i = 2P = {1, 2, 4}T = {3}d(1, 2) = min{3, 0.5 +} =3d(1, 3) = min{8.5, 3+4} = 7
Step 4:
i = 3P = {1, 2, 3, 4}
3 4
80.5
2
1
4
3
(1, 3)
(1, 0.5)
(2, 7)
Step 3
3 4
80.5
2
1
4
3
(1, 3)
(1, 0.5)
(2, 7)
Step 4
Figure : Dijkstras algorithm
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 13 / 15
-
Link State Routing Dijkstras Algorithm
Example 2
State the differences between distance-vector and link-statebased routing algorithms.Use Dijkstras algorithm, showing all steps, to derive the shortestpath tree rooted at node A for the network graph with indicatedlink weights as shown below.
B
A
C
E
F
D
G
Figure : An example for Dijkstras algorithm
Prof. Izhak Rubin (UCLA) EE 132B 2014 Fall 14 / 15
-
Link State Routing Dijkstras Algorithm
Example 2 - Sol.
Table : Dijkstras Algorithm
A (0,A) (0,A) (0,A) (0,A) (0,A) (0,A) (0,A)B (, null) (2, A) (2,A) (2,A) (2,A) (2,A) (2,A)C (, null) (5, A) (5, A) (5,A) (5,A) (5,A) (5,A)D (, null) (, null) (6,B) (6,B) (6,B) (6,B) (6,B)E (, null) (, null) (12,B) (12,B) (8,D) (8,D) (8,D)F (, null) (, null) (, null) (19,C) (19,C) (12,E) (12,E)G (, null) (, null) (, null) (, null) (24,D) (24,D) (17,F)
B
A
C
E
F
D
G
Figure : Shortest Path TreeProf. Izhak Rubin (UCLA) EE 132B 2014 Fall 15 / 15
IntroductionDistance Vector RoutingLink State RoutingDijkstra's Algorithm