Title: Chapter 4 Distance Vector Routing
1Chapter 4Distance Vector Routing
- Professor Rick Han
- University of Colorado at Boulder
- rhan_at_cs.colorado.edu
2Announcements
- Programming assignment 2 is due Saturday March 1
by 1159 pm - Short Homework 3 due Thurs Feb. 20
- Homework 1 solutions should be up soon
- Midterm probably week of March 11 13
- Next, more on IP routing,
3Recap of Previous Lecture
- ARP
- IP Forwarding Tables
- Destination and Output Port
- IP Routing
- Distributed algorithm to create Forwarding Tables
- Calculate shortest path to each node
- Distance Vector (RIP)
- Send distance vectors to neighbors
- Update route to each destination thru closest
neighbor - If neighbor X is closer than neighbor Y to
destination D, then route thru X to D
4Link Failure Causes Bouncing Effect
dest
cost
dest
cost
via
via
1
X
A
B
B
A
1
1
B
A
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
5B Notices A-B Link Failure
B notices failure, resets cost via A to infinity
dest
cost
dest
cost
via
via
A
B
B
A
1
B
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
6C Sends Dist. Vector to B
dest
cost
dest
cost
via
via
A
B
B
A
3
1
B
C
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
7B Updates Distance to A
dest
cost
dest
cost
via
via
A
B
B
A
3
C
1
B
C
2
C
1
B
C
Packet sent to A from C bounces between C and
B until TTL0!
1
25
C
8B Sends Dist. Vector to C
dest
cost
via
dest
cost
via
A
B
B
A
3
C
1
B
C
2
B
C
1
C
- C updates distance to A from 2 to 4. Why
increase the distance? - Because shortest path was thru B B just
advertised a new distance
1
25
C
9C Sends Dist. Vector to B
dest
cost
dest
cost
via
via
A
B
B
A
5
C
1
B
C
2
C
1
B
C
B adds one to Cs advertised distance to A.
(overrides its stored distance of 3 to A with
5, larger value)
1
25
C
dest
cost
via
A
4
B
B
1
B
10Link Failure Bad News Travels Slowly
dest
cost
dest
cost
via
via
A
B
B
A
25
C
26
C
C
25
C
1
C
C
After 20 exchanges, routing tables look like
this
1
25
Assume A has advertised its link cost of 25 to C
during Blt-gtC exchanges. C ignores these as too
large (or could store in its distance table (not
shown))
C
dest
cost
via
A
24
B
B
1
B
11Bad News Travels Slowly (2)
dest
cost
dest
cost
via
via
A
B
B
A
25
C
26
C
C
25
C
1
C
C
B sends its dist Vector, C updates dist to A to
26 via B
1
25
C
12Bad News Travels Slowly (3)
dest
cost
dest
cost
via
via
A
B
B
A
25
C
26
C
C
25
C
1
C
C
A sends its distance vector to C, so C chooses
shorter path of 25 via A
1
25
C
13Bad News Travels Slowly (4)
dest
cost
dest
cost
via
via
A
B
B
A
26
C
26
C
C
25
C
1
C
C
After 25 B-C exchanges, finally converge
to stable routing
1
25
C
dest
cost
via
A
25
A
B
1
B
14Link Failure Causes Counting to Infinity Effect
dest
cost
dest
cost
via
via
1
X
A
B
B
A
1
1
B
A
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
15B Notices A-B Link Failure
dest
cost
dest
cost
via
via
A
B
B
A
1
B
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
16C Sends Dist. Vector to B
dest
cost
dest
cost
via
via
A
B
B
A
3
C
1
B
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
17A-C Link Fails
dest
cost
via
A
B
A
3
C
C
1
C
1
- C detects link to A has failed, but no change in
Cs routing table. Why? - Shortest path to A is via B, not C
C
dest
cost
via
A
2
B
B
1
B
18B and C Count to Infinity
dest
cost
via
A
B
A
3
C
C
1
C
1
C
dest
cost
via
A
4
B
B
1
B
19B and C Count to Infinity (2)
dest
cost
via
A
B
A
5
C
C
1
C
1
C
dest
cost
via
A
4
B
B
1
B
20How are These Loops Caused?
- Observation 1
- Bs metric increases
- Observation 2
- C picks B as next hop to A
- But, the implicit path from C to A includes
itself (C ) !
21Solution 1 Holddowns
- If metric increases, delay propagating
information - In our example, B sees its metric increase and
delays advertising its distance vector - C eventually thinks Bs route is gone, picks its
own route - B then selects C as next hop
- Adversely affects convergence from failures
22Other Solutions
- Split horizon
- Cs distance vector does not advertise routes
thru B that it learned from B - Poisoned reverse
- Cs distance vector advertises routes thru B that
it learned from B with infinite distance - Works for two node loops
- Does not work for loops with more nodes
23B Notices A-B Link Failure
dest
cost
dest
cost
via
via
A
B
B
A
1
B
C
2
C
1
B
C
1
25
C
dest
cost
via
A
2
B
B
1
B
24Split Horizon
dest
cost
dest
cost
via
via
A
B
B
A
1
B
C
2
C
1
B
C
25
C
dest
cost
via
A
25
A
C updates its path to A through A (knows its
link cost to A)
B
1
B
25Split Horizon (2)
dest
cost
dest
cost
via
via
A
B
B
A
26
C
1
B
C
2
C
1
B
C
1
25
dest
cost
C
dest
cost
via
A B 1
25
A
25
A
B
1
B
26Split Horizon With Poisoned Reverse
dest
cost
dest
cost
via
via
A
B
B
A
--
1
B
C
2
C
1
B
C
1
25
dest
cost
C
dest
cost
via
A
A
2
B
B
1
B
1
B
If lowest cost path is via B, then when updating
B send infinite cost
27Example Where Split Horizon Fails
- When link breaks, C marks D as unreachable and
reports that to A and B - Suppose A learns it first
- A now thinks best path to D is through B
- A reports D unreachable to B and a route of
cost3 to C - C thinks D is reachable through A at cost 4 and
reports that to B - B reports a cost 5 to A who reports new cost to C
- etc...
1
A
B
1
1
C
X
1
D
28Avoiding the Counting to Infinity Effect
- Select loop-free paths
- One way of doing this
- Each route advertisement carries entire path
- If a router sees itself in path, it rejects the
route - BGP does it this way
- Space proportional to diameter
29Loop Freedom at Every Instant?
- Does bouncing effect avoid loops?
- No! Transient loops are still possible
- Why? Because implicit path information may be
stale - See this in BGP convergence
- Only way to fix this
- Ensure that you have up-to-date information by
explicitly querying
30Loop Prevention in Practice
- RIP and RIP2
- Uses split-horizon/poison reverse
- BGP
- Propagates entire path
- Path also used for effecting policies
31Bellman-Ford Equation
- Distance vector RIP based on distributed
implementation of Bellman-Ford algorithm - Bellman-Ford equation
- Label routers iA, B, C,
- Let D(i,j) distance for best route from i to
remote j - Let d(i,j) distance from router i to neighbor j
- Set to infinity if ij or i and j not immediate
neighbors
32Bellman-Ford Equation (2)
- Bellman-Ford equation
- D(i,j) min d(i,k) D(k,j) for all iltgtj
- k
- neighbors
- Ex. D(B,F) min d(B,k) D(k,F)
- kA,C,E
33Bellman-Ford Algorithm
- Bellman-Ford equation
- D(i,j) min d(i,k) D(k,j) for all iltgtj
- k neighbors
- Bellman-Ford Algorithm solves B-F Equation
- To calculate D(i,j), node i only needs d(i,k)s
and D(k,j)s from neighbors - Problem dont know D(k,j)s
- Solution
- For each node i, first find shortest distance
path from i to j using one link, D(i,j)1 - Shortest distance path using two or fewer links,
D(i,j)2, must depend on the shortest distance
path using one link, namely D(i,j)2 min
d(i,j) D(i,j)1
34Bellman-Ford Algorithm (2)
- Key observation
- By induction, the best (h1 or fewer)-hop path
between nodes i and j must be arise from an
i-to-neighbor link connected with a (h or
fewer)-hop path from neighbor to j - D(i,j)h1 min d(i,k) D(k,j)h
- Bellman-Ford Algorithm
- D(i,j)h1 min d(i,k) D(k,j)h for all
iltgtj, h0,1, - k neighbors
- Iterate h0,1,2, until reach diameter DM of
graph - D(i,j)DM is the originally desired B-F solution
D(i,j) ! - At each h, calculate D(i,j)h1 for all iltgtj
- At h0, D(i,j)0 0 for ij, infinity
otherwise - D(i,i)h link cost on which dist. vector is
sent - 1
35Bellman-Ford Algorithm Example
- Suppose C wants to find shortest path to each
destination - First, calculate shortest one-link paths from
each node easy, D(i,j)1d(i,j)
- D(C,B)1, D(C,D)1, and
- D(B,A)1, D(B,E)1, D(B,C)1, and
- D(D,E)1, D(D,C)1, and
- D(A,B)1, D(A,E)1, D(A,F)1, and
- D(E,A)1, D(E,B)1, D(E,D)1, D(E,F)1, and
- D(F,A)1, D(F,E)1
36Bellman-Ford Algorithm Example (2)
- Second, calculate shortest 2-or-fewer hop paths
from each node - Example for node C to F
- D(C,F)2 min (d(C,k) D(k,F)1) for all j
- k neighbors
- min d(C,B) D(B,F)1, d(C,D)
D(D,F)1
- No one-link path from B to F, so D(B,F)1 is
infinity, same for D(D,F)1 - Calculate D(i,j)2 for all other combinations of
iltgtj
37Bellman-Ford Algorithm Example (3)
- Third, calculate shortest 3-or-fewer hop paths
from each node - Example for node C to F
- D(C,F)3 min d(C,B) D(B,F)2, d(C,D)
D(D,F)2 - No more unknowns
- D(B,F)2 is known by now and was calculated in
the last iteration, mind(B,k) D(k,F)1 - D(D,F)2 is also known
- Since diameter 3, were done and have found all
shortest distance paths D(i,j)
38Distributed Bellman-Ford Algorithm
- Bellman-Ford Algorithm
- D(i,j)h1 min d(i,k) D(k,j)h for all
iltgtj, h0,1, - k neighbors
- One way to implement in a real network
- Flood d(i,j) first to every router in the network
- Calculate B-F Algorithm in each router
- Drawbacks
- Generates lots of overhead
- Requires much computation on each router
- Duplication of many of calculations on each
router - Consider an alternative to distribute calculations
39Distributed Bellman-Ford Algorithm (2)
- Bellman-Ford Algorithm
- D(i,j)h1 min d(i,k) D(k,j)h for all
iltgtj, h0,1, - k neighbors
- Key observations
- We had to calculate D(i,j)h for each node i in
the graph, at each step h in the iteration - At every iteration h, we only needed information
about the h-1 or fewer hop paths to calculate
D(i,j)h
40Distributed Bellman-Ford Algorithm (3)
- Therefore, in a real network,
- Physically distribute the calculation of
D(i,j)h to router i only, and - No duplication
- Less calculation
- Exchange the results of your D(i,j)h with
neighboring routers at each iteration h - Less overhead
- Satisfies condition that D(i,j)h only needs
info on h-1 or less hop paths. - At iteration h, d(i,j) within radius h-1 will be
propagated to all routers within radius h-1
41Distributed Bellman-Ford Algorithm (4)
- In practice, convergence will eventually occur
even if different routers are slow to propagate
or calculate their D(i,j)h and/or d(i,j) - Bertsekas and Gallagher proved this, in the
absence of topology changes - Distributed routing algorithm where each router
only performs a small but sufficient part of the
overall B-F algorithm - Node i calculates and sends D(i,j)h to its
neighbors this is a distance vector - Distributed Bellman-Ford Algorithm Distance
Vector Algorithm
42Distance Table
- Bellman-Ford Algorithm
- D(i,j)h1 min d(i,k) D(k,j)h for all
iltgtj, h0,1, - k neighbors
- Each router i must maintain a distance table
- Must store d(i,k), D(k,j)h for each neighbor k
and destination j
43Distance Table (2)
- In reality, each cell in distance table stores
d(i,k) D(k,j)h, not just D(k,j)h - Must store d(i,k) or receive it within a
neighbors distance vector advertisement - If d(i,k) is a hop, then d(i,j)1 always, so no
need to store
44Routing Table
- Easy to derive a Routing Table from a distance
table choose the minimum distance in the row