Download Dijkstra's Algorithm and Distance Vector Algorithm: Comparison and Analysis and more Slides Computer Networks in PDF only on Docsity!
The Network Layer
Part 1: Routing
Today
Starting on the internals of the network layer
Application Transport Network Link Layer Physical
Context and Terminology
“End hosts” “Clients”, “Users” “End points” “Interior Routers” “Border Routers” “Autonomous System (AS)” or “Domain” Region of a network under a single administrative entity “Route” or “Path”
Lecture#2: Routers Forward Packets to MIT to UW
UCB
to NYU Destination Next Hop UCB 4 UW 5 MIT 2 NYU 3 Forwarding Table 111010010 MIT switch# switch# switch# switch#
Routing Protocols
- Routing protocols implement the core function of a network
- Establish paths between nodes
- Part of the network’s “control plane”
- Network modeled as a graph
- Routers are graph vertices
- Links are edges
- Edges have an associated “cost”
- Goal: compute a “good” path from source to destination
- “good” usually means the shortest (least cost) path A D E B C F 2 2 1 3 1 1 2 5 3 5
Internet Routing
- Internet Routing works at two levels
- Each AS runs an intra-domain routing protocol that
establishes routes within its domain
- (AS -- region of network under a single administrative entity)
- Link State, e.g., Open Shortest Path First (OSPF)
- Distance Vector, e.g., Routing Information Protocol (RIP)
- ASes participate in an inter-domain routing protocol that establishes
routes between domains
- Path Vector, e.g., Border Gateway Protocol (BGP)
Outline
- Link State
- Distance Vector
- Routing: goals and metrics (if time)
Link-State
Link State Routing
- Each node maintains its local “link state” (LS)
- Each node floods its local link state
- on receiving a new LS message, a router forwards the message to all its neighbors other than the one it received the message from Host A Host B Host E Host D Host C N1 N N N N N6 N (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5) (N1,N2) (N1, N4) (N1, N5)
Link State Routing
- Each node maintains its local “link state” (LS)
- Each node floods its local link state
- Hence, each node learns the entire network topology
- Can use Dijkstra’s to compute the shortest paths between nodes Host A Host B Host E Host D Host C N1 N N N N N6 N A B (^) E D C A B (^) E D C A B (^) E D C A B (^) E D C A B (^) E D C A B (^) E D C A B (^) E D C
Example
A D E B C F 2 2 1 3 1 1 2 5 3 5
Notation
- c(i,j): link cost from node i
to j ; cost is infinite if not
direct neighbors; ≥ 0
- D(v): total cost of the current
least cost path from source
to destination v
- p(v): v ’s predecessor along
path from source to v
- S: set of nodes whose least
cost path definitively known
A D E B C F 2 2 1 3 1 1 2 5 3 5 Source
Example: Dijkstra’s Algorithm
Step 0 1 2 3 4 5 set S A D(B),p(B) 2,A D(C),p(C) 5,A D(D),p(D) 1,A D(E),p(E) (^) D(F),p(F) A D E B C F 2 2 1 3 1 1 2 5 3 5
1 Initialization: 2 S = {A}; 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v); 6 else D(v) = ; …
Example: Dijkstra’s Algorithm
Step 0 1 2 3 4 5 set S A D(B),p(B) 2,A D(C),p(C) 5,A … 8 Loop 9 find w not in S s.t. D(w) is a minimum; 10 add w to S ; 11 update D(v) for all v adjacent to w and not in S : 12 If D(w) + c(w,v) < D(v) then 13 D(v) = D(w) + c(w,v); p(v) = w; 14 until all nodes in S; A D E B C F 2 2 1 3 1 1 2 5 3 5 D(D),p(D) 1,A D(E),p(E) (^) D(F),p(F)