Final Distance Vector Routing
Final Distance Vector Routing
Routing
Chicago
Indianapolis
Effingham
St. Louis
Routing
• Definition
– The task of constructing and maintaining
forwarding information (in hosts or routers)
• Goals
– Capture the notion of “best” routes
– Propagate changes effectively
– Require limited information exchange
• Conceptually
– A network can be represented as a graph where
each host/router is a node and each physical
connection is a link
Routing
• Factors
– Network topology can change
– Traffic conditions can change
• Design elements
– Performance criteria
– Decision time and place
– Information source
• Goals
– Correctness
– Simplicity
– Robustness
– Fairness
– High throughput
– Low end-to-end latency
Routing: Ideal Approach
B C For each
A direction,
maintain:
•Bandwidth
D
G •Latency
E
•Queueing
F
delay
Routing: Ideal Approach
• Problems
– Unbounded amount of information
– Queueing delay can change rapidly
– Graph connectivity can change rapidly
• Solution
– Dynamic
• Periodically recalculate routes
– Distributed
• No single point of failure
• Reduced computation per node
– Abstract Metric
• “Distance” may combine many factors
• Use heuristics
Routing Overview
• Algorithms
– Static shortest path algorithms
• Bellman-Ford
– Based on local iterations
• Dijkstra’s algorithm
– Build tree from source
– Distributed, dynamic routing algorithms
• Distance vector routing
– Distributed Bellman-Ford
• Link state routing
– Implement Dijkstra’s algorithm at each node
Bellman-Ford Algorithm
• Concept
– Static centralized algorithm
• Given
– Directed graph with edge costs and destination
node
• Finds
– Least cost path from each node to destination
• Multiple nodes
– To find shortest paths for multiple destination
nodes, run entire Bellman-Ford algorithm once per
destination
Bellman-Ford Algorithm
A B C
∞ ∞ ∞
∞ 6 ∞ 2 1 Dest
∞ 3 C 1 Dest
8 D 3 C 1 Dest
8 D 3 C 1 Dest
7 D 3 C 1 Dest
1 1 1
D E Destination
∞ ∞
∞ 2 5 Dest 5
7 E 5 Dest
7 E 4 B
6 E 4 B
6 E 4 B
Distance Vector Routing
(F,0)
(F,2) C E
(F,1)
Example - Initial Distances
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 ~ ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2
D E 1 8 ~ 2 0
E
E Receives D’s Routes
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 ~ ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2
D E 1 8 ~ 2 0
E
E Updates Cost to C
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 ~ ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2 E 1 8 4 2 0
E D
A Receives B’s Routes
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 ~ ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2
D E 1 8 4 2 0
E
A Updates Cost to C
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 8 ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2 E 1 8 4 2 0
E D
A Receives E’s Routes
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 8 ~ 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2 E 1 8 4 2 0
E D
A Updates Cost to C and D
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 5 3 1
B 7 0 1 ~ 8
A 8 2 C ~ 1 0 2 ~
D ~ ~ 2 0 2
1 2
D E 1 8 4 2 0
E
Final Distances
Distance to node
1 Info at
B C node A B C D E
7 A 0 6 5 3 1
B 6 0 1 3 5
A 8 2 C 5 1 0 2 4
D 3 3 2 0 2
1 2
D E 1 5 4 2 0
E
Final Distances After Link Failure
Distance to node
1 Info at
B C node A B C D E
7 A 0 7 8 10 1
B 7 0 1 3 8
A 8 2 C 8 1 0 2 9
D 10 3 2 0 11
1 2 E 1 8 9 11 0
E D
View From a Node
A 1 14 5
A 8 2
B 7 8 5
1 2 C 6 9 4
E D D 4 11 2
Count-to-infinity Problem
25 1
dest cost
C A 2
B 1
C Sends Routes to B
25 1
dest cost
C A 2
B 1
B Updates Distance to A
Really through B
dest cost dest cost
B 1 A B A 3
C 2 C 1
25 1
dest cost
C A 2
B 1
B Sends Routes to C
25 1
dest cost
C A 4
B 1
C Sends Routes to B
25 1
dest cost
C A 4
B 1
Distance Vector Routing
• Problem
– Node X notices that its link to Y is broken
– Other nodes believe that the route through
X is still good
– Mutual deception!
How Are These Loops Caused?
• Observation 1:
– B’s metric increases
• Observation 2:
– C picks B as next hop to A
– But, the implicit path from C to A includes
itself!
Solution 1: Holddowns
A B
25 C 1
• If metric increases, delay propagating
information
– in our example, B delays advertising route
– C eventually thinks B’s route is gone, picks its own
route
– B then selects C as next hop
• Adversely affects convergence
Heuristics for breaking loops
• Set infinity to 16
– Small limit allows fast completion of “counting to
infinity”
– Limits the size of the network
• Split horizon
– Avoid counting to infinity by solving “mutual
deception” problem
• Split horizon with poisoned reverse
– “Poison” the routes sent to you by your neighbors
• Sequence numbers on delay estimates
Split Horizon
A B
25 C 1
• Avoid counting to infinity by solving “mutual
deception” problem
• Distance Vector with split horizon:
– when sending an update to node X, do not include
destinations that you would route through X
– If X thinks route is not through you, no effect
– If X thinks route is through you, X will timeout
route
Split Horizon and Poisoned
Reverse
A B
25 C 1
• Distance Vector with Split Horizon and Poisoned
Reverse:
– When sending update to node X, include destinations that
you would route through X with distance set to infinity
– Don’t need to wait for X to timeout
• Problem:
– Router on edge of Internet would need to include infinity
route for all outside destinations on Internet!
Split Horizon
A 1
∞
1
1
1
C D
B
Split Horizon
A 1 D=∞
∞
1
1
C D
D=∞
B
Split Horizon
A 1 D=∞
∞
D=2
1
1
C D
B D=∞ ⊗ D=∞
Split Horizon
D=3
A 1
∞
D=∞
1
1
C D
B
Split Horizon
A 1
∞
1
1
C D
B
Example Where Split Horizon
Fails
• Link breaks
– C marks D as unreachable
and reports that to A and B.
• Suppose A learns it first.
A 1 B
– A now thinks best path to D
is through B.
– A reports a route of cost=3
to C.
1 1 • C thinks D is reachable
through A at cost 4 and
C reports that to B.
• B reports a cost 5 to A who
1 reports new cost to C.
D • etc...
Avoiding Counting to Infinity
• Problem
– Information propagates slowly
• One period per hop for new routes
• Count to infinity to detect lost routes
Dijkstra’s Algorithm
• Given
– Directed graph with edge weights
(distances)
• Calculate
– Shortest paths from one node to all others
Dijkstra’s Algorithm
3 4 3
1 1
2 7 4
9
2 2 6 7 11
7
2 1 9
2 3 2 6
7 2
4 11
1
6
12
6 3
10 13
8 15
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
4 ADEBC 4, E
Example
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
4 ADEBC 4, E
Link State Routing
• Strategy
– Send all nodes information about directly connected links
– Status of links is flooded in link state packets (LSPs)
• Each LSP carries
– ID of node that created the LSP
– Vector of <neighbor, cost of link to neighbor> pairs for the
node that created the LSP
– Sequence number
– Time-to-live (TTL)
• Each node maintains a list of (ideally all) LSP’s and
runs Dijkstra’s algorithm on the list
Link state: update propagation
Each node maintains
a “topology database” F tells all routers:
there is a link
between F and E
[C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F]
[C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] B D [C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F]
A [C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] [C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] [C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] [C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] F
[C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F]
[C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F] C E
[C,A]
[D,E]
[C,E]
[C,B]
[A,B]
[B,D]
[E,F]
[D,F]
B D
A F
C E
B D
IP packet A F
source destination
C E
• Downsides of link-state:
– Lesser control on policy (certain routes can’t be filtered), more cpu
– Increased visibility (bad for privacy, but good for diagnostics)
Link State Routing
B
5 3
10
A C
11
2
Find paths from D
to all other nodes D
Link State Routing
3. 6
4.
7
5 B 3
10
A C
11
2
D
Link State Routing
A 3 C
Packet from C->A 5 2
may loop around BDC D
Link State Routing
D
B O
H I
M
E
A
C G J P
In regular link-state,
routers maintain map
of entire topology
Hierarchical routing O
H I
M
A
D
B O
H I
M
E
A
C G J P
• Advantages: scalability
– Reduce size of link-state database
– Isolate rest of network from changes/faults
• Disadvantages
– Complexity
• Extra configuration effort
• Requires tight coupling with address assignment
– Inefficiency
• One link change may affect multiple path costs
• Summarization hides shorter paths
LS vs. DV
• Avoiding oscillations
– What if metrics are a function of offered load?
– Causes dependencies across paths
Challenge #1: Avoiding
oscillations
2
3 1
1
3
2 1 5
20
congested link
Original ARPANET Algorithm
• Light load
– Delay dominated by the constant part
(transmission and propagation delay)
• Medium load
– Queuing delay no longer negligable
– Moderate traffic shifts to avoid congestion
• Heavy load
– Very high metrics on congested links
– Busy links look bad to all of the routers
– All routers avoid the busy links
– Routers may send packets on longer paths
Second ARPANET Algorithm
(1979)
• Averaging of link metric over time
– Old: Instantaneous delay fluctuates a lot
– New: Averaging reduces the fluctuations
• Link-state protocol instead of DV
– Old: DV led to loops
– New: Flood metrics and let each router compute shortest
paths
• Reduce frequency of updates
– Old: Sending updates on each change is too much
– New: Send updates if change passes a threshold
Problem #2: Load balancing