# Routing

Document Sample

```					Routing
Routing algorithm builds the routing table

routing algorithm

local forwarding table
Subnet 1   3
Subnet 2   2
……      2
1

0111                 1

3 2

2
Graph abstraction of networks

v   w
u           z
x   y

3
Routing Overview
 Abstract network as a graph
 Routers/hubs and end systems are nodes
 Links and channels are edges
 Use graph-theory to:
 Describe network
• Diameter, connectivity, bisection bandwidth …
   Run algorithms
• Shortest path finds routes, find articulation points ..
   Prove properties
• Likelihood of being connected …

4
Graph abstraction
5
3
v           w    5
2
u           2           1         z
3
1                         2
x   1
y
Graph: G = (N,E)

N = set of routers = { u, v, w, x, y, z }

E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

5
Graph abstraction: costs
5
• c(x,x’) = cost of link (x,x’)
3
v           w   5
2                             - e.g., c(w,z) = 5
u           2           1       z
3               • cost could represent hop count,
1                       2       bandwidth, or congestion
x   1
y

6
Graph abstraction: costs
5
• c(x,x’) = cost of link (x,x’)
3
v           w   5
2                              - e.g., c(w,z) = 5
u           2           1       z
3                • cost could represent hop count,
1                       2        bandwidth, or congestion
x   1
y

Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

Question: What’s the least-cost path between u and z ?

Routing algorithm: algorithm that finds least-cost path

7
Routing algorithm
 Given the whole graph, shortest path can be
computed using Dijsktra’s algorithm.

8
Dijkstra’s algorithm: example
Step        N'   D(v),p(v) D(w),p(w)             D(x),p(x)   D(y),p(y)   D(z),p(z)
0        u          2,u       5,u                   1,u          ∞          ∞
1       ux          2,u       4,x                               2,x         ∞
2      uxy          2,u       3,y                                          4,y
3     uxyv                    3,y                                          4,y
4    uxyvw                                                                 4,y
5   uxyvwz

5
3
v           w   5
2
u           2           1        z
3
1                       2
x   1
y

9
Dijkstra’s algorithm: example (2)
Resulting shortest-path tree from u:

v     w
u                    z
x     y

Resulting forwarding table in u:
v       (u,v)
x       (u,x)
y       (u,x)
w       (u,x)
z       (u,x)
10
Dijskstra’s Shortest Path
Algorithm

7
B                               C
2           2               3           3

2
A                   E       F                       D
1                       2
2
6
4
G                               H

11
Shortest Path Intuition

 To find the shortest path from X to Y
 Select the next shortest path from X to a node
we have not yet found a shortest path to
 Eventually we’ll select node Y
 We must keep selecting shortest paths from
other nodes because some path to Y through a
node Z might be shorter

12
Computing the Shortest Path
 Dijkstra’s Shortest Path Algorithm:
   Step 1: Draw nodes as circles. Fill in a circle to mark it as a
“permanent node.”
   Step 2: Set the current node equal to the source node
   Step 3: For the current node:
• Mark the cumulative distance from the current node to each
non-permanent adjacent node. Also mark the name of the
current node. Erase this marking if the adjacent node
already has a shorter cumulative distance marked
• Mark the non-permanent node with the shortest listed
cumulative distance as permanent and set the current node
equal to it. Repeat step 3 until all nodes are marked
permanent.

13
Dijskstra’s Shortest Path
Algorithm
Example

7
B                                   C
2           2                   3           3

2
A                   E           F                       D
1                           2
2
6
4
G                                   H

Selected edge
Candidate edge
Not visited
14
Dijskstra’s Shortest Path
Algorithm
Example

7
B                                   C
2           2                   3           3

2
A                   E           F                       D
1                           2
2
6
4
G                                   H

Selected edge
Candidate edge
Not visited
15
Dijskstra’s Shortest Path
Algorithm
Example

7
B                                   C
2           2                   3           3

2
A                   E           F                       D
1                           2
2
6
4
G                                   H

Selected edge
Candidate edge
Not visited
16
Dijskstra’s Shortest Path
Algorithm
Example

7
B                                   C
2           2                   3           3

2
A                   E           F                       D
1                           2
2
6
4
G                                   H

Selected edge
Candidate edge
Not visited
17
Example

Step   Confirmed           Candidate
Edge List           Edge List
(neighbor,cost,nexthop)

1      (A,0,-)

(A,0,-)             (A,2,B)
(A,0,-)            (G,6,G)     Select Edge
3      (A,2,B)
(A,0,-)            (G,6,G)
4
(B,4,E)
(A,0,-)            (G,6,G)
5      (A,2,B)                        Select Edge
(B,4,E)            (B,9,C)
18
Routing algorithm
 Given the whole graph, shortest path can be
computed using Dijsktra’s algorithm.

 How to retrieve the whole graph?

19
Routing Algorithm
 Given the whole graph, shortest path can be
computed using Dijsktra’s algorithm.

 How to retrieve the whole graph?
   Each router measures the distance (in delay, hop
count, etc.) between itself and its adjacent routers
   Each router distributes these packets using flooding

20
 Each router builds a packet containing all
neighbor distances information.
   The packet also contains a sequence number (control
flooding) and an age field.
 Each router distributes these packets using
flooding
 Each router builds map of the entire network
 uses a shortest-path algorithm to build
routing table
21
Routing algorithms
   Flooding + Dijsktra’s algorithm

 Others?

22
Shortest path through neighbors
5                       d(v->z) = 5,
3                   d(x->z) = 3,
v           w
2                   5       d(w->z) = 3
u           2           1       z
3
1                       2       d(u->z) = min { c(u,v) + d(v,z),
x           y
1                                c(u,x) + d(x,z),
c(u,w) + d(w,z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
(through x)

23
Distance Vector
 Each router maintains lists of best-known distances to
all other known routers. These lists are called
“vectors.”

 Periodically, vectors are exchanged between adjacent
routers, and each router updates its vectors.

24
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}     Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2                       Dy(z), c(x,z) + Dz(z)}
node x table                                                 = min{2+1 , 7+0} = 3
cost to             cost to
x y z               x y z
x 0 2 7              x 0 2 3
from

from
y ∞∞ ∞               y 2 0 1
z ∞∞ ∞               z 7 1 0
node y table
cost to
x y z                                                           y
2       1
x ∞ ∞ ∞
x               z
y 2 0 1                                                           7
from

z ∞∞ ∞
node z table
cost to
x y z
x ∞∞ ∞
from

y ∞∞ ∞
z 71 0
time
25
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}       Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2                         Dy(z), c(x,z) + Dz(z)}
node x table                                                   = min{2+1 , 7+0} = 3
cost to              cost to               cost to
x y z                x y z                 x y z
x 0 2 7              x 0 2 3               x 0 2 3
from

from
y ∞∞ ∞               y 2 0 1

from
y 2 0 1
z ∞∞ ∞               z 7 1 0               z 3 1 0
node y table
cost to              cost to               cost to
x y z                x y z                 x y z                 y
2       1
x ∞ ∞ ∞              x 0 2 7               x 0 2 3         x               z
from

y 2 0 1              y 2 0 1                                       7
from

from
y 2 0 1
z ∞∞ ∞               z 7 1 0               z 3 1 0
node z table
cost to              cost to               cost to
x y z                x y z                 x y z

x ∞∞ ∞             x 0 2 7               x 0 2 3
from

from

y 2 0 1               y 2 0 1
from

y ∞∞ ∞
z 71 0             z 3 1 0               z 3 1 0
time
26
Distance Vectors (example 2)

?

27
Distance Vectors (example 2)

28
Convergence Speed
status change in the network

 With distance vector routing
 Good news travels fast

29
Convergence speed
1   2   3   4   Initially
A   B   C   D   E

30
Count-to-Infinity
1      2       3       4   Initially
A   B       C       D      E

3       2      3       4   After 1 exchange

3       4      3       4   After 2 exchanges

5       4      5       4   After 3 exchanges

5       6      5       6   After 4 exchanges

7       6      7       6   After 5 exchanges

etc… to infinity
31
Poisoned Reverse

 If Z routes through Y to get to X :
 Z tells Y its (Z’s) distance to X is infinite (so Y won’t
route to X via Z)

32
Poisoned Reverse

A   B        C      D      E

inf.     2      3      4      B learns A is dead
B reports to C that
inf. inf. 2     3      4
A’s metric is inf.
inf.     inf.   3      4      After 1 exchange

inf.     inf.   inf.   4      After 2 exchanges

inf.     inf.   inf.   inf.   After 3 exchanges

33
Poisoned Reverse

 If Z routes through Y to get to X :
 Z tells Y its (Z’s) distance to X is infinite (so Y won’t
route to X via Z)

 will this completely solve count to infinity
problem?

34
Poisoned Reverse Failure

A       B

If D goes down, A and
B will still count to
infinity.
C

D

35
Routing algorithms
 Distance Vector

 Sufficient for the whole Internet?

36
Hierarchical Routing
Our routing study thus far - idealization
 all routers identical
 network “flat”
… not true in practice

scale: with 200 million       administrative autonomy
destinations:                internet = network of
 can’t store all dest’s in     networks
routing tables!              each network admin may
 routing table exchange        want to control routing in its

37
Hierarchical Routing
 aggregate routers into          Gateway router
regions, “autonomous
 Direct link to router in
systems” (AS)
another AS
 routers in same AS run
same routing protocol
   “intra-AS” routing
protocol
   routers in different AS
can run different intra-
AS routing protocol

38
Hierarchical Routing (cont’d)

39
Interconnected ASes

3c
3a                                        2c
3b                                        2a
AS3                                               2b
1c                              AS2
1a              1b
1d               AS1
 Forwarding table is
configured by both
intra- and inter-AS
Intra-AS
Routing
Inter-AS
Routing            routing algorithm
Intra-AS sets entries
algorithm     algorithm

Forwarding                       for internal dests
Inter-AS & Intra-As
table

sets entries for
external dests
40
Routing protocols
 Intra-AS protocols
   RIP (Distance Vector)
 Inter-AS protocols
 BGP

41
RIP ( Routing Information Protocol)

 Distance vector algorithm
 Included in BSD-UNIX Distribution in 1982
 Distance metric: # of hops (max = 15 hops)
 Distance vectors: exchanged among neighbors
every 30 sec via Response Message (also
destination nets within AS

42
RIP
 Did not scale well
   suffered the count-to-infinity problem
   weak security
 RIP is phased out for large backbones
 but still widely used for smaller networks

43
OSPF: Open Shortest Path
First
 Support:
 Security: all OSPF messages authenticated
 Multiple same-cost paths allowed (only one path in RIP)
 For each link, multiple cost metrics
 Hierarchical OSPF in large domains.

44
Hierarchical OSPF

45
Hierarchical OSPF
 Two-level hierarchy: local area, backbone.
 each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.
 Area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.
 Backbone routers: run OSPF routing limited to
backbone.
 Boundary routers: connect to other AS’s.

46
BGP (Border Gateway Protocol)

 The de facto standard
 BGP provides each AS a means to:
1. Obtain subnet reachability information from
neighboring ASs.
2. Propagate reachability information to all AS-
internal routers.
3. Determine “good” routes to subnets based on
reachability information and policy.
 allows subnet to advertise its existence to
rest of Internet: “I am here”

47
BGP basics
 Pairs of routers (BGP peers) exchange
routing info over semi-permanent TCP
connections: BGP sessions

3c
3a                        2c
3b                       2a
AS3                              2b
1c              AS2
1a        1b
AS1    1d
eBGP session
iBGP session
48
BGP messages
 BGP messages:
 OPEN: opens TCP connection to peer and
authenticates sender
 UPDATE: advertises new path (or withdraws old)
 KEEPALIVE keeps connection alive in absence of
 NOTIFICATION: reports errors in previous msg;
also used to close connection

49
Path attributes & BGP routes
BGP attributes.
   prefix + attributes = “route”
 Two important attributes:
 AS-PATH: contains ASs through which prefix
 NEXT-HOP: Indicates specific internal-AS router
to next-hop AS. (There may be multiple links from
current AS to next-hop-AS.)

50
AS1

AS2

AS3
AS4

51
BGP route selection
 Router may learn about more than 1 route
to some prefix. Router must select route.
 Elimination rules:
1.   Local preference value attribute: policy
decision
2.   Shortest AS-PATH
3.   Closest NEXT-HOP router: hot potato routing

52
BGP routing policy
legend:   provider
B                              network
X
W           A
customer
C                             network:

Y

Figure 4.5-BGPnew: a simple BGP scenario
 A,B,C are provider networks
 X,W,Y are customer (of provider networks)
 X is dual-homed: attached to two networks
 X does not want to route from B via X to C
 .. so X will not advertise to B a route to C

53
BGP routing policy (2)
legend:   provider
B                              network
X
W          A
customer
C                             network:

Y

 A advertises to B the path AW
Figure 4.5-BGPnew: a simple BGP scenario

 B advertises to X the path BAW
 Should B advertise to C the path BAW?
 No way! B gets no “revenue” for routing CBAW since neither
W nor C are B’s customers
 B wants to force C to route to w via A
 B wants to route only to/from its customers!
54
Why different Intra- and Inter-AS routing ?

Policy:
 Inter-AS: admin wants control over how its traffic
routed, who routes through its net.
 Intra-AS: single admin, so no policy decisions needed
Scale:
 hierarchical routing saves table size, reduced update
traffic
Performance:
 Intra-AS: can focus on performance
 Inter-AS: policy may dominate over performance

55
Summary
 Routing Algorithms
   Distance Vector
 Routing Protocols
 Intra-AS protocols
• RIP (Distance Vector)
   Inter-AS protocols
• BGP

56
 Deliver packets from source to all other nodes

R1
duplicate
R2

R3        R4

in-network
duplication

57
In-network duplication
 Flooding: when node receives brdcst pckt,
sends copy to all neighbors
   Problems: cycles & broadcast storm
 Controlled flooding: node only brdcsts pkt
if it hasn’t brdcst same packet before
 Node keeps track of pckt ids already brdcsted
 Or reverse path forwarding (RPF): only forward
pckt if it arrived on shortest path between
node and source
 Spanning tree
 No redundant packets received by any node

58
Spanning Tree

A

B
c

D
F       E

G

59
Multicast Routing
 Goal: Deliver packets from source to a
subset of nodes

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 19 posted: 11/26/2011 language: English pages: 60
How are you planning on using Docstoc?