Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run...

32
1 Intra-Domain Routing 6.829 Jacob Strauss September 14, 2006

Transcript of Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run...

Page 1: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

1

Intra-Domain Routing

6.829

Jacob Strauss

September 14, 2006

Page 2: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

2

Review: Learning Bridges (Switches)

Bridge builds a forwarding table

Destination -> Output port

Learned from incoming packets

Forwarding:

For every packet, we need to lookup the output port toward itsdestination

If address not found or broadcastflood to all but input port

Update forwarding table

Loop Avoidance

Elect a root Bridge

Construct Spanning Tree to root

B

C

D

F

A

Destination

2

1

2

3

1

Port

G 3

S2

Switch

G

C

A

S11

3

2

B

D

F

Page 3: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

3

Learning Bridge Scaling Problems

Forwarding entry per destination

Large tables

Floods for unknown destinations

Cannot mix physical network types

Inefficient Routes

Concentrates traffic at a few switches

Not shortest path

Okay for short paths, not for long

Cannot use redundancyB

C

D

F

A

Destination

2

1

2

3

1

Port

G 3

S2

Switch

G

C

A

S11

3

2

B

D

F

Page 4: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

4

Bridge Scaling Problems

Chicago

Connect buildings in different cities with direct links:

San Francisco

Atlanta

Seattle

Boston

Suppose Chicago is the Root Switch: Which links are used?

Page 5: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

5

Bridge Scaling Problems

Chicago

San Francisco

Atlanta

Seattle

Boston

All packets go through Chicago switch -- not shortest path

Page 6: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

6

Add a layer over Ethernet: IP & Routing

Add a new protocol over physical layerNo longer tied to Ethernet

Hierarchal AddressingAll addresses in Boston start with 18.1.x.x Chicago start with 18.2.x.x

Forwarding tables stay small with fewer updates

Separate Routing from ForwardingRouting is finding the path

Forwarding is action of sending the packet to the next-hop toward itsdestination

Each router has a forwarding tableForwarding tables are created by a routing protocol

D

G

CB

A

E

R2

R3

R1

RouterD

EG

A -- C

Destination

R2R3

R3

R1

Next-hopInput ports

Page 7: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

7

Picture of the Internet

Internet: A collection of Autonomous Systems (AS)Defined by control, not geography

Routing:

Intra-Domain Routing (this lecture)

Inter-Domain Routing (BGP: next lecture)

AS-1

AS-2

AS-3

Interior router

Border router

Page 8: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

8

Factors Affecting Routing

Routing algorithms viewthe network as a graph

Intra-domain routing:nodes are routers

Inter-domain routing:nodes are ASes

Problem: find lowest costpath between two nodes(Shortest Path)

FactorsSemi-dynamic topology(deal with link failures)Dynamic loadPolicy

4

3

6

21

9

1

1

D

A

FE

B

C

Examples of link cost:Distance, load, price,congestion/delay, …

Page 9: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

9

Problem: Shortest Path Routing

Objective: Determine the route from each router (R1, …, R7) to R8 that minimizes the cost.

R5

R3

R7

R6R4R2R1

1 1 4

2

4

2 2 3

23

R8

Page 10: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

10

Solution is simple by inspection... (inthis case)

R3

R1

R5

R4

R8

R6

The shortest paths from all sources to a destination (e.g., R8) is the spanning tree routed at that destination.

R2

R7

1 1 4

2

4

2 23

2 3

Page 11: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

11

Two Main Approaches

Distance Vector ProtocolsE.g., RIP (Routing Information Protocol)

Based on Distributed Bellman-Ford Algorithm

Link State ProtocolsE.g., OSPF (Open Shortest Path First)

Based on Dijkstra Algorithm

Page 12: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

12

Technique1: Distributed Bellman-Ford Algorithm

R5

R3

R7

R8

R6R4R2R1

Example

1 1 4

2

4

2 2 3

23

Initial State: All routers except R8 set their route cost to .R8 sets its route cost to 0.

0

Each router keeps track of next hop to destination, cost todestination

Page 13: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

13

Technique1: Distributed Bellman-Ford AlgorithmExample

R5

R3

R7

R8

R6R4R2R1

1 1 4

2

4

2 2 3

23

3, R8R7

2, R8R6

2, R8R5

InfR4

4, R8R3

InfR2

InfR1

42 3

2

Every T seconds, each Router tells its neighbors its route cost to R8

Each router updates its cost as min(current cost, received cost + linkcost)

Set next hop to the source of the lowest cost message

Routing tables have both the next-hop and the cost

Page 14: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

14

Technique1: Distributed Bellman-Ford AlgorithmExample

R5

R3

R7

R8

R6R4R2R1

1 1 4

2

4

2 2 3

23

3, R8R7

2, R8R6

2, R8R5

6, R7R4

4, R8R3

4, R5R2

6, R3R1

42 3

2

Repeat until no costs change

6 4 6

Page 15: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

15

Technique1: Distributed Bellman-Ford AlgorithmExample

R5

R3

R7

R8

R6R4R2R1

1 1 4

2

4

2 2 3

23

3, R8R7

2, R8R6

2, R8R5

6, R7R4

4, R8R3

4, R5R2

6, R3R1

42 3

26 4 6

R5

R3

R7

R8

R6R4R2R1

1

2

4

2

23

3, R8R7

2, R8R6

2, R8R5

5, R2R4

4, R8R3

4, R5R2

5, R2R1

42 3

26 4 5

Solution

1

Page 16: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

16

Distributed Bellman-Ford Algorithm

Questions:

1. How long will the algorithm take to stabilize?

2. How do we know that the algorithm alwaysconverges?

3. What happens when link costs change, or whenrouters/links fail?

Page 17: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

17

A Problem with Bellman-Ford

R4R3R2R1

1 1 1

“Bad news travels slowly”

Consider the calculation of distances to R4:

3

2

1

1, R42,R33,R20

R3R2R1Time

X

3,R22,R33,R2

R3 -- R4 fails

4

Page 18: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

18

A Problem with Bellman-Ford

R4R3R2R1

1 1

“Bad news travels slowly”

Consider the calculation of distances to R4:

……

5,R24,R35,R23

2

1

1, R42,R33,R20

R3R2R1Time

…… “Counting to infinity”

3,R22,R33,R2

R3-R4 fails

3,R24,R33,R2

5,R26,R35,R24

Page 19: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

19

How are These Loops Caused?

Observation 1:R3’s metric increases

Observation 2:R2 picks R3 as next hop to R4

But, the implicit path from R2 to R4 includes itself

R4R3R2R1

1 1

Page 20: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

20

Solutions to Counting to Infinity

Set infinity = “some small integer” (e.g. 16). Stopwhen count = 16.

Split Horizon: Because R2 received lowest costpath from R3, it does not advertise cost to R3

Split-horizon with poison reverse: R2 advertisesinfinity to R3

R4R3R2R1

1 1

Page 21: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

21

Comments on Bellman-Ford

Asynchronous

Works when some costs (i.e., weights) arenegative, as long as there is no negative cost cycle.

Why?

The graph may be directed (not in the distributedcase)

Small messages, small state at each router No router has a complete image of the graph

Page 22: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

22

Two Main Approaches

Distance Vector ProtocolsE.g., RIP (Routing Information Protocol)

Based on Distributed Bellman-Ford Algorithm

Link State ProtocolsE.g., OSPF (Open Shortest Path First)

Based on Dijkstra Algorithm

Page 23: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

23

Link State Routing

Start condition

Each node assumed to know state of links to its neighbors

Phase 1

Each node broadcasts its state to all other nodes

Reliable flooding mechanism

Phase 2

Each node locally computes shortest paths to all other nodesfrom global state

Dijkstra’s shortest path tree (SPT) algorithm

Page 24: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

24

Phase 1: Link State Packets (LSPs)

Periodically, each node creates a link state packetcontaining:

Node ID

List of neighbors and link cost

Sequence number

Time to live (TTL)

Node outputs LSP on all its links

When a router receives a LSP from nodeKeep most recent packet from each source

Forward to other routers

All routers learn complete graph

Page 25: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

25

Phase 2:Dijkstra’s Shortest Path First Algorithm

Assumptions:Costs are positive

Each router has the complete graph. Is it scalable?

For each source, finds spanning tree routed onsource router.

Page 26: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

26

Dijkstra’s Key Idea:At each step, consider nodes with edgesto nodes in set S; Pick the next closestnode to destination and move it to S;update distances from destination

R8

R5

R5R3

R7

R6R4R2R1

1 1 4

2

4

2 2 3

2 3

R8

Set S: nodes where shortest path to destination is already known

Set C: all nodes with direct edges to any node in S

Step 1: S = {R8}, C = {R3,R5,R7,R6}

Step 2: S = {R8 ,R5}, C = {R3, R7, R6, R2}

R8

Page 27: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

27

Dijkstra’s Key Idea:At each step, consider nodes with edgesto nodes in set S; Pick the next closestnode to destination and move it to S;update distances from destination

R6

R8

R5

R8

R5

R5R3

R7

R6R4R2R1

1 1 4

2

4

2 2 3

2 3

R8

Step 1: S = {R8}, C = {R3,R5,R7,R6}

Step 2: S = {R8 ,R5}, C = {R3, R7, R6, R2}

R8

Step 3: S = {R8 ,R5 ,R6}, C = {R3, R7, R2 , R4}

Page 28: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

28

Dijkstra’s Key Idea:At each step, consider nodes with edgesto nodes in set S; Pick the next closestnode to destination and move it to S;update distances from destination

R6

R8

R6

R8

R5

R8

R5

R5

R7

R5R3

R7

R6R4R2R1

1 1 4

2

4

2 2 3

2 3

R8

Step 1: S = {R8}, C = {R3,R5,R7,R6}

Step 2: S = {R8 ,R5}, C = {R3, R7, R6, R2}

R8

Step 3: S = {R8 ,R5 ,R6}, C = {R3, R7, R2 , R4}

Step 4: S = {R8, R5, R6, R7}, C = {R3, R2 , R4}

And so on…

Page 29: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

29

Dijkstra’s SPF Algorithm

R5

R7

R3

R4R2

R8

R6R1

1 1

42

3

2

{}.

},,,,,,,{ 4127658

=

=

C

RRRRRRRS :8 Step

2

Page 30: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

30

OSPF optimizations

Don’t send updates to all other routersElect a root router, send updates there

Root broadcasts link database to all routers

AreasRun routing algorithm separately in each area

Graph not propagated to other areas

Reduce state needed on each router• Operator needs to assign routers to areas

Page 31: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

31

Summary: LS vs. DV

Message size

Small in Link State (only state to neighbors)

Large in Distance Vector (costs to all destinations)

Convergence speed

LS: faster – done once topology disseminated

Space requirements

LS maintains entire topology

DV maintains only neighbor state

Robustness:

Can be made robust since sources are aware of alternate paths

Incorrect calculation can spread to entire network

Page 32: Intra-Domain Routingnms.lcs.mit.edu/6.829-f06/lectures/intradomain.pdf · 2006-09-28 · Run routing algorithm separately in each area Graph not propagated to other areas Reduce state

32

Summary: LS vs. DV

Bottom line: no clear winner,

Link State more prevalent in intra-domain routingProtocol details

(inter-domain uses BGP which is based on DV)