View
34
Download
2
Category
Preview:
DESCRIPTION
The network layer: routing. CS168, Fall 2014 Sylvia Ratnasamy http://inst.eecs.berkeley.edu/~cs168/fa14/. Last Time. Forwarding: “data plane” Directing one data packet Each router using local routing state Routing: “control plane” Computing the forwarding tables that guide packets - PowerPoint PPT Presentation
Citation preview
The network layer: routing
CS168, Fall 2014Sylvia Ratnasamy
http://inst.eecs.berkeley.edu/~cs168/fa14/
Last Time
‣ Forwarding: “data plane” - Directing one data packet- Each router using local routing state
‣ Routing: “control plane” - Computing the forwarding tables that guide packets- Jointly computed by routers using a distributed ptotocol
‣ Routing will be our focus for the next ~2 lectures!
Last Time
‣ Two correctness conditions for routing state:- no deadends
- no loops
Outline
‣ Least-cost path routing
‣ Approach 1: link-state routing
‣ Approach 2: distance-vector routing
‣ Routing in the Internet (next lecture)
dest. next hopz ?
41 2
v
u z
v ?
link costs
could represent: propagation delay
dest. next hopu ?v ?
dest. next hopz ?u ?
6
41 2
v
u z
least-cost path from u to z: u v z
least cost path from u to v: u v
vv v
v
dest. next hopzu u
zdest. next hop
zdest. next hop
uv v
Least-cost path routing
‣ Given: router graph & link costs
‣ Goal: find least-cost path
from each source router to each destination router
7
“Least Cost” Routes
‣ “Least cost” routes an easy way to avoid loops- No sensible cost metric is minimized by traversing a loop
‣ Least cost routes are also “destination-based”- i.e., do not depend on the source- Why is this?
‣ Least-cost paths form a spanning tree
Outline
‣ Least-cost path routing
‣ Approach 1: link-state routing
‣ Approach 2: distance-vector routing
‣ Routing in the Internet
9
10
u z
v
4
1 2
dest. next hopzv
cost
*
11
u z
v
4
1 2
dest. next hopzv
zv
cost41
*
12
u z
v
4
1 2
dest. next hopzv
zv
cost41
v 3
*
13
v
2
1 3
u z
x
21
dest. next hopzv
cost
x
*
14
v
2
1 3
u z
x
21
dest. next hopzv
cost
x
- -v 1x 2
*
15
v
2
1 3
u z
x
21
dest. next hopzv
cost
x
- -v 1x 2
v 4
*
16
v
2
1 3
u z
x
21
dest. next hopzv
cost
x
- -v 1x 2
v 4x 3
*
17
2
1
3
z2
1
v
yx
3
5
1
2
u
w
5
dest. next hopzw
cost
yvx
*
18
2
1
3
z2
1
v
yx
3
5
1
2
w
u
5
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
*
19
2
1
z2
1
v
yx
3
5
1
2
u
w35
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
x 4x 2
*
20
2
1
z2
1
v
yx
3
5
1
2
u
w35
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
x 4x 2
*
21
2
1
3
z2
1
v
yx
3
5
1
2
u
w
5
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
x 4x 2
x 43
*
22
2
1
3
z2
1
v
yx
3
5
1
2
u
w
5
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
x 4x 2
x3
4
*
23
2
1
3
z2
1
v
yx
3
5
1
2
u
w
5
dest. next hopzw
cost
yvx
- -
v 2x 1
w 5- -
x 4x 2
x3
4
*
Routing algorithm for source u
‣ Input: router graph & link costs
‣ Output: least-cost path
from source router u to every other router
24
Dijkstra’s algorithm
‣ Source router considers every other router- starting from next “closest” neighbor
‣ Checks whether it can improve current paths- by using that router as an intermediate point
‣ Ends when all intermediaries have been considered
‣ See text / 61C notes for exact algorithm25
From routing algorithm to protocol
‣ Note: Dijkstra’s is a local computation! - computed by one node given complete network graph
‣ Possibilities:- Option#1: a separate machine runs the algorithm - Option#2: every router runs the algorithm
‣ The Internet currently uses Option#2
26
Link State Routing
‣ Every router knows its local “link state” - router u: “(u,v) with cost=2; (u,x) with cost=1”
‣ A router floods its link state to all other routers- does so periodically or when its link state changes
‣ Hence, every router learns the entire network graph- runs Dijkstra’s locally to compute its forwarding table
‣ OSPF is a link-state protocol (IETF RFC 2328 or 5340)- Berkeley runs OSPF internally!
Link State Routing
‣ Are loops possible?
A and D think that thisis the path to C
E thinks that thisis the path to C
A
ED
CB
FA
ED
CB
F
13
1
15
5
55
5
Convergence
‣ All routers have consistent routing information- E.g., all nodes having the same link-state database
‣ Forwarding is consistent after convergence- All nodes have the same link-state database
- All nodes forward packets on same paths
Convergence Delay
‣ Time to achieve convergence
‣ Sources of convergence delay?- time to detect failure- time to flood link-state information- time to re-compute forwarding tables
‣ Performance during convergence period?- lost packets due to blackholes- looping packets- out-of-order packets reaching the destination
Link State Routing
‣ Are loops possible?- yes, until convergence
‣ Scalability?- O(NE) messages - O(N2) computation time - O(network diameter) convergence time - O(N) entries in forwarding table
‣ Do we have to use Dijkstra’s?
Outline
‣ Least-cost path routing
‣ Approach 1: link-state routing
‣ Approach 2: distance-vector routing
‣ Routing in the Internet
32
Experiment
‣ Your job: find the youngest person in the room
‣ Ground Rules- You may not leave your seat, nor shout loudly across the class - You may talk with your immediate neighbors
(hint: “exchange updates” with them)
‣ At the end of 5 minutes, I will pick a victim and ask: - who is the youngest person in the room? (name , date)- which one of your neighbors first told you this information?
Go!
Example of Distributed Computation
I am one hop away
I am one hop away
I am one hop away
I am two hops away
I am two hops away
I am two hops away
I am two hops awayI am three hops away
I am three hops away
DestinationI am three hops away
36
x z
y
7
2 1
x
xy
0-
y z
z
2 7- -
- - -from
to
2 0 1
x
xy
-
y z
z
- -
- - -
x
xy
--
y z
z
- -- -
7 1 0
This is y’s “distance vector”
2 0 1
37
x z
y
7
2 1
x
xy
y z
z2 0 1
from
tox
xy
0
y z
z
2 7
x
xy
y z
z 7 1 07 1 02 0 1
720
720
7 1 0
720
7 1 02 0 1
38
x z
y
7
2 1
xxy
y z
z
2 0 1from
tox
xy
0
y z
z
2 3
xxy
y z
z 7 1 07 1 02 0 1
720
2 0 1
39
x z
y
7
2 1
xxy
y z
z
2 0 1from
tox
xy
0
y z
z
2 3
xxy
y z
z 3 1 07 1 0
720
7 1 0
2 0 1720
2 0 1
40
x z
y
7
2 1
xxy
y z
z
2 0 1
3 1 0
from
tox
xy
0
y z
z
2 3
xxy
y z
z
3
3 1 03 1 0
320
202 0 1
41
xxy
0-
y v
v
1 2- -
- - -from
to
y
2
1 3
z
v
1x
z
---
xxy
-1
y v
- -0 -
z - - -
z
-3-
xyv
--
y v
z
- -- -
- 3 1
z
--0
xx -
y v
v- -
2 - 0z - - -
z
-1-
42
xxy
01
y v
v
1 20 -
2 - 0from
to
y
2
1 3
z
v
1x
z
-31
xyv
y v z
z - 3 1
0
xxy 1
y v
0 -z
z
3
xx
y v
v 2 - 0z
z
1
1 0 -2 - 0
31
0 1 2 -
- 3 1
0
- 3 1 0
0 1 2 -
43
xxy
01
y v
v
1 20 -
2 - 0from
to
y
2
1 3
z
v
1x
z
331
xyv
y v z
z - 3 1 0
xxy 1
y v
0 -z
z
3
xx
y v
v 2 - 0z
z
1
1 0 -2 - 0
310
0 1 2 -
- 3 1
- 3 1 0
0 1 2 -
44
xxy
01
y v
v
1 20 -
2 - 0from
to
y
2
1 3
z
v
1x
z
331
xyv
1
y v
z
0 -2 - 0
z
31
3 3 1 0
xxy 1
y v
0 -z
z
3
xx
y v
v 2 - 0z
z
1
0
0 1 2 -
- 3 1
- 3 1 0
0 1 2 -
45
xxy
01
y v
v
1 20 -
2 - 0from
to
y
2
1 3
z
v
1x
z
331
xyv
1
y v
z
0 -2 - 0
z
31
3 3 1 0
xxy 1
y v
0 3z
z
3
xx
y v
v 2 - 0z
z
1
0
0 1 2 -
- 3 1
- 3 1 0
0 1 2 -
46
xxy
01
y v
v
1 20 -
2 - 0from
to
y
2
1 3
z
v
1x
z
331
xyv
1
y v
z
0 -2 - 0
z
31
3 3 1 0
xxy 1
y v
0 3z
z
3
xx
y v
v 2 3 0z
z
1
0
0 1 2 -
- 3 1
- 3 1 0
0 1 2 -
47
xxy
01
y v
v
1 20 3
2 3 0from
to
y
2
1 3
z
v
1x
z
331
xyv
1
y v
z
0 32 3 0
z
31
3 3 1 0
xxy 1
y v
0 3z
z
3
xx
y v
v 2 3 0z
z
1
0
0 1 2 3
3 3 1
3 3 1 0
0 1 2 3
Distance-vector routing
‣ Input to each router: local link costs & neighbor
messages
‣ Output of each router: least-cost path to every other
router
48
‣ Distributed algorithm‣ All routers run it “together”
- each router runs its own instance- neighbors exchange and react to each
other’s messages
49
Distance-vector routing
Bellman-Ford algorithm
‣ All neighbors exchange information- Each router checks whether it can improve current
paths by leveraging the new information‣ Ends when no improvement is possible
50
51
x z
y
7
2 1
2 0 1from
tox
xy
0
y z
z
2 7
7 1 0
dx(z) = cost(x,z),
cost(x,y) + dy(z)
min{
}
52
y
7
2
dx(z) = cost(x,y) + dy(z),
cost(x,u) + du(z),
min{
}
w
x u
1
z
cost(x,w) + dw(z)
53
y
7
2
cost(x,n) + dn(z)minn{ }
w
x u
1
z
for all neighbors n
dx(z) =
Bellman-Ford equation
Bellman-Ford equation
‣ Formalizes the following decision:
- pick as the next hop for destination z the neighbor that results in the least-cost path to z.
x z
y
7
2 1
2 0 1
x
y
y z
z 3 1 0
x
y
y z
z 3 1 02 0 1
0 1
56
x z
y
7
1
x
y
y z
z 3 1 0
x
y
y z
z 3 1 02 0 1
4routing loop!
0 1
57
x z
y
7
1
x
y
y z
z 3 1 0
x
y
y z
z 3 1 04 0 1
4routing loop!
0 1
58
x z
y
7
1
x
y
y z
z 3 1 0
x
y
y z
z 5 1 04 0 1
4routing loop!
0 1
59
x z
y
7
1
x
y
y z
z 5 1 0
x
y
y z
z 5 1 04 0 1
4routing loop!
0 1
60
x z
y
7
1
x
y
y z
z 5 1 0
x
y
y z
z 5 1 04 0 1
6routing loop!
0 1
61
x z
y
7
1
x
y
y z
z 5 1 0
x
y
y z
z 5 1 06 0 1
6routing loop!
0 1
62
x z
y
7
1
x
y
y z
z 5 1 0
x
y
y z
z 7 1 06 0 1
6routing loop!
0 1
63
x z
y
7
1
x
y
y z
z 7 1 0
x
y
y z
z 7 1 06 0 1
6routing loop!
0 1
64
x z
y
7
1
x
y
y z
z 7 1 0
x
y
y z
z 7 1 06 0 1
8routing loop!
0 1
65
x z
y
7
1
x
y
y z
z 7 1 0
x
y
y z
z 7 1 08 0 1
8routing loop!
0 1
66
x z
y
7
1
x
y
y z
z 7 1 0
x
y
y z
z 7 1 08 0 1
8routing loop!
count-to-infinity scenario
Problems with Bellman-Ford
‣ Routing loops- z routes through y, y routes through x
- y loses connectivity to x
- y decides to route through z
‣ Can take a very long time to resolve- Count-to-infinity scenario
68
x z
y
7
2 1
2 0 1
x
y
y z
z ∞ 1 0
x
y
y z
z 3 1 02 0 1
poisoned reverse
69
x z
y
7
1
0 1
x
y
y z
z 1 0
x
y
y z
z 3 1 02 0 1
∞poisoned reverse∞
70
x z
y
7
1
0 1
x
y
y z
z 1 0
x
y
y z
z 3 1 00 1
∞poisoned reverse∞
∞
71
x z
y
7
1
0 1
x
y
y z
z 1 0
x
y
y z
z 7 1 00 1
∞poisoned reverse∞
∞
72
x z
y
7
1
0 1
x
y
y z
z 1 0
x
y
y z
z 7 1 00 1
poisoned reverse∞
∞
7
73
x z
y
7
1
0 1
x
y
y z
z 1 0
x
y
y z
z 7 1 00 1poisoned reverse ∞
78
Solution
‣ Poisoned reverse- If z routes to x through y,
z advertises to y that its cost to x is infinite
- y never decides to route to x through z
‣ Often avoids the count-to-infinity problem
Distance Vector Routing
‣ Are loops possible?- yes, until convergence - convergence slower than in Link-State
‣ Scalability?- requires fewer messages than Link-State- O(N) update time on arrival of a new DV from neighbor- O(network diameter) convergence time - O(N) entries in forwarding table
‣ RIP is a protocol that implements DV (IETF RFC 2080)
Does Poison-Reverse Completely Solve the Count-to-Infinity Problem?
A C1
B
D
1
1 11 1
2 2
∞
∞ ∞
100
100 100
3∞
4
∞ 4
56
Outline
‣ Least-cost path routing
‣ Approach 1: link-state routing
‣ Approach 2: distance-vector routing
‣ Routing in the Internet (next time)
Recommended