Document not found! Please try again

4.5 Routing algorithms

48 downloads 189968 Views 827KB Size Report
Mar 24, 2012 ... Textbook: Computer Networking : a Top-Down Approach , 5/E. By Kurose and Ross – Original Slides from Authors (modified). 2. • Link state.
NET 331 – Computer Networks Lecture 11 IP Routing Principles Dr. Anis Koubaa

Reformatted slides from textbook Computer Networking – a top-down appraoch, Fifth Edition by Kurose and Ross, (c) Pearson Education - Prentice Hall, 2011

24-Mar-12

Chapter 4: Network Layer

4.5 Routing algorithms • Link state • Distance Vector • Hierarchical routing

NET 331: Computer Networks,

by Dr. Anis Koubaa

2

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Interplay between routing, forwarding routing algorithm

local forwarding table header value output link 0100 0101 0111 1001

3 2 2 1

value in arriving packet’s header

1

0111

3 2

NET 331: Computer Networks,

by Dr. Anis Koubaa

3

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Graph Abstraction

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) } Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections

NET 331: Computer Networks,

by Dr. Anis Koubaa

4

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Graph abstraction: costs 5

v

• c(x,x’) = cost of link (x,x’) 3

w

2

u

2 1

x

3 1

z

1

y

- e.g., c(w,z) = 5

5

• cost could always be 1, or inversely related to bandwidth, or inversely related to congestion

2

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 NET 331: Computer Networks,

by Dr. Anis Koubaa

5

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Routing Algorithm classification Static or dynamic? Static:

Global or decentralized information? Global:

routes change slowly over time

all routers have complete topology, link cost info “link state” algorithms

Dynamic: routes change more quickly

Decentralized:

periodic update in response to link cost changes

router knows physicallyconnected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms NET 331: Computer Networks,

by Dr. Anis Koubaa

6

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Chapter 4: Network Layer

4.5 Routing algorithms • Link state • Distance Vector • Hierarchical routing

NET 331: Computer Networks,

by Dr. Anis Koubaa

7

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

A Link-State Routing Algorithm Notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known

Dijkstra’s algorithm net topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info

computes least cost paths from one node (‘source”) to all other nodes gives forwarding table for that node

iterative: after k iterations, know least cost path to k dest.’s NET 331: Computer Networks,

by Dr. Anis Koubaa

8

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Dijsktra’s Algorithm

NET 331: Computer Networks,

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

9

by Dr. Anis Koubaa

Dijkstra’s algorithm: example D(v) D(w) D(x) D(y) D(z) Step 0 1 2 3 4 5

N'

p(v)

p(w)

p(x)

u uw uwx uwxv uwxvy uwxvyz

7,u 6,w 6,w

3,u

5,u ∞ ∞ 5,u 11,w ∞ 11,w 14,x 10,v 14,x 12,y

p(y)

p(z)

x 9

Notes:

5

construct shortest path tree by tracing predecessor nodes ties can exist (can be broken arbitrarily)

7

4 8 3

u

w

y 3

7

z 2

4

v NET 331: Computer Networks,

by Dr. Anis Koubaa

10

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Dijkstra’s algorithm: another example Step 0 1 2 3 4 5

D(v),p(v) D(w),p(w) 2,u 5,u 2,u 4,x 2,u 3,y 3,y

N' u ux uxy uxyv uxyvw uxyvwz

D(x),p(x) 1,u

D(y),p(y) ∞ 2,x

D(z),p(z) ∞ ∞

4,y 4,y 4,y

5

v

w

5

2

u

2 1

NET 331: Computer Networks,

3

x

z

1

3

2

y

1

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

11

by Dr. Anis Koubaa

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

v

w

u

z x

y

Resulting forwarding table in u: destination

link

v x

(u,v) (u,x)

y

(u,x)

w

(u,x)

z

(u,x)

NET 331: Computer Networks,

by Dr. Anis Koubaa

12

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Dijkstra’s algorithm, discussion Algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n2) more efficient implementations possible: O(nlogn) Oscillations possible: e.g., link cost = amount of carried traffic D

1 0

1

A 0 0

C

1+e

B

e

2+e

D

0 1

e

initially NET 331: Computer Networks,

A 1+e 1

C

D

B

0

1

… recompute routing by Dr. Anis Koubaa

A

0

0

0 0

2+e

B

C 1+e

… recompute 13

2+e

D

0

A 1+e 1

C

0

B

e

… recompute

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Chapter 4: Network Layer

4.5 Routing algorithms • Link state • Distance Vector • Hierarchical routing

NET 331: Computer Networks,

by Dr. Anis Koubaa

14

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } v where min is taken over all neighbors v of x

NET 331: Computer Networks,

by Dr. Anis Koubaa

15

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Bellman-Ford example 5

v

3

w

2

u

2 1

x

5

z

1

3 1

Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3

y

2

B-F equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4

Node that achieves minimum is next hop in shortest path ➜ forwarding table NET 331: Computer Networks,

by Dr. Anis Koubaa

16

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance Vector Algorithm Dx(y) = estimate of least cost from x to y x maintains distance vector Dx = [Dx(y): y є N ]

node x: knows cost to each neighbor v: c(x,v) maintains its neighbors’ distance vectors. For each neighbor v, x maintains Dv = [Dv(y): y є N ]

NET 331: Computer Networks,

by Dr. Anis Koubaa

17

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance vector algorithm (4) Basic idea: from time-to-time, each node sends its own distance vector estimate to neighbors when x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) ← minv{c(x,v) + Dv(y)}

for each node y ∊ N

under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)

NET 331: Computer Networks,

by Dr. Anis Koubaa

18

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance Vector Algorithm (5) Iterative, asynchronous: each Each node: local iteration caused by: local link cost change wait for (change in local link DV update message from cost or msg from neighbor) neighbor Distributed: recompute estimates each node notifies neighbors only when its DV changes if DV to any dest has changed, notify neighbors

neighbors then notify their neighbors if necessary

NET 331: Computer Networks,

by Dr. Anis Koubaa

19

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2

node x table cost to x y z

= min{2+1 , 7+0} = 3 cost to x y z from

from

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

Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)}

x 0 2 3 y 2 0 1 z 7 1 0

2

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

from

x 7

x ∞∞ ∞ y ∞∞ ∞ z 71 0

NET 331: Computer Networks,

y

time

by Dr. Anis Koubaa

20

1

z

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3

Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2

x ∞∞ ∞ y ∞∞ ∞ z 7 1 0

NET 331: Computer Networks,

x 0 2 3 y 2 0 1 z 7 1 0

x 0 2 3 y 2 0 1 z 3 1 0

from

cost to x y z

x 0 2 7 y 2 0 1 z 7 1 0

from

from

cost to x y z

cost to x y z x 0 2 7 y 2 0 1 z 3 1 0

by Dr. Anis Koubaa

y

2

x 0 2 3 y 2 0 1 z 3 1 0

x 7

1

z

cost to x y z from

from

from

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

cost to x y z

cost to x y z

from

from

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

from

node x table cost to x y z

21

x 0 2 3 y 2 0 1 z 3 1 0 time

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance Vector: link cost changes Link cost changes:

1

node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors

“good news travels fast”

4

y 1

x

z 50

t0 : y detects link-cost change, updates its DV, informs its neighbors. t1 : z receives update from y, updates its table, computes new least cost to x , sends its neighbors its DV. t2 : y receives z’s update, updates its distance table. y’s least costs do not change, so y does not send a message to z.

NET 331: Computer Networks,

by Dr. Anis Koubaa

22

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Distance Vector: link cost changes Link cost changes: 60

good news travels fast bad news travels slow - “count to infinity” problem! 44 iterations before algorithm stabilizes: see text

4

y 1

x

z 50

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? NET 331: Computer Networks,

by Dr. Anis Koubaa

23

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Comparison of LS and DV algorithms Robustness: what happens if router malfunctions? LS:

Message complexity LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only

node can advertise incorrect link cost each node computes only its own table

convergence time varies

Speed of Convergence LS: O(n2) algorithm requires O(nE) msgs

DV: DV node can advertise incorrect path cost each node’s table used by others

may have oscillations

DV: convergence time varies may be routing loops count-to-infinity problem NET 331: Computer Networks,

by Dr. Anis Koubaa

error propagate thru network 24

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Chapter 4: Network Layer

4.5 Routing algorithms • Link state • Distance Vector • Hierarchical routing

NET 331: Computer Networks,

by Dr. Anis Koubaa

25

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Hierarchical Routing administrative autonomy internet = network of networks each network admin may want to control routing in its own network

scale: with 200 million destinations: can’t store all dest’s in routing tables! routing table exchange would swamp links!

Our routing study thus far - idealization all routers identical network “flat” … not true in practice NET 331: Computer Networks,

by Dr. Anis Koubaa

26

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Hierarchical Routing gateway router at “edge” of its own AS has link to router in another AS

aggregate routers into regions, “autonomous systems” (AS) routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing protocol

NET 331: Computer Networks,

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

27

by Dr. Anis Koubaa

Interconnected ASes 3c 3b

3a AS3

forwarding table configured by both intraand inter-AS routing algorithm

2a 1c 1a

NET 331: Computer Networks,

by Dr. Anis Koubaa

AS2

1d

1b

Intra-AS Routing algorithm

intra-AS sets entries for internal dests inter-AS & intra-As sets entries for external dests

2c 2b

AS1

Inter-AS Routing algorithm

Forwarding table

28

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Inter-AS tasks AS1 must: learn which dests are reachable through AS2, which through AS3 propagate this reachability info to all routers in AS1 job of inter-AS routing!

suppose router in AS1 receives datagram destined outside of AS1: router should forward packet to gateway router, but which one?

3c 3b

3a AS3

other networks

1a AS1

NET 331: Computer Networks,

2c

1c

2a 1b

1d

29

by Dr. Anis Koubaa

2b

other networks

AS2 Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Example: Setting forwarding table in router 1d suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2. inter-AS protocol propagates reachability info to all internal routers

router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c. installs forwarding table entry (x,I)

x

3c 3b

3a AS3

other networks

NET 331: Computer Networks,

2c

1c 1a AS1

1d

by Dr. Anis Koubaa

2a 1b 30

2b

other networks

AS2 Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Example: Choosing among multiple ASes now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. to configure forwarding table, router 1d must determine which gateway it should forward packets towards for dest x this is also job of inter-AS routing protocol!

x

3c 3b

3a AS3

other networks

1a AS1

NET 331: Computer Networks,

2c

1c

2a

1d

1b

?

by Dr. Anis Koubaa

31

2b

other networks

AS2 Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Example: Choosing among multiple ASes now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x. this is also job of inter-AS routing protocol!

hot potato routing: send packet towards closest of two routers. Learn from inter-AS protocol that subnet x is reachable via multiple gateways

Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways

NET 331: Computer Networks,

by Dr. Anis Koubaa

Hot potato routing: Choose the gateway that has the smallest least cost

32

Determine from forwarding table the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table

Textbook: Computer Networking : a Top-Down Approach , 5/E By Kurose and Ross – Original Slides from Authors (modified)

Suggest Documents