+ All Categories
Home > Documents > Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell...

Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell...

Date post: 10-May-2018
Category:
Upload: vuquynh
View: 229 times
Download: 1 times
Share this document with a friend
20
1 CS 4410 Operating Systems Networking: Routing Algorithms Summer 2016 Cornell University
Transcript
Page 1: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

1

CS 4410 Operating Systems

Networking:

Routing Algorithms

Summer 2016

Cornell University

Page 3: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

The routing problem

• A host is usually attached directly to one router: default router.

• Source router: default router of the source host.

• Destination router: default router of the destination host.

• Target: route a packet from source router to destination router. – Given a set of routers connected with links, a routing

algorithm finds a “good” path from source router to destination router.

– “good” is usually “low cost” (e.g., length, speed, money).

3

Page 4: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Least-cost path

• A graph G is used to formulate routing problems.

• G=(N,E) – N: nodes that represent routers – E: edges that represent physical

links

• Each edge has a value representing its cost.

• Find a path between the source and destination that has least cost.

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

4

Page 5: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm

• Compute the least-cost path from one node to all other nodes in the network.

• Iterative algorithm. – After the kth iteration, the least-cost paths for k

destination nodes are found.

• D(v): cost of the least-cost path from source node to destination v

• p(v): previous node of v along the least-cost path from source.

• N’: set of nodes to which the least-cost path is found.

5

Page 6: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

• Source is node u.

Step 0

N' u

D(v),p(v) 2,u

D(w),p(w) 5,u

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

D(y),p(y) ∞

D(z),p(z) ∞

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

6

Page 7: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

• Source is node u.

Step 0 1

N' u

ux

D(v),p(v) 2,u 2,u

D(w),p(w) 5,u 4,x

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

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

D(z),p(z) ∞ ∞

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

7

Page 8: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

• Source is node u.

Step 0 1 2

N' u

ux uxy

D(v),p(v) 2,u 2,u 2,u

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

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

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

D(z),p(z) ∞ ∞ 4,y

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

8

Page 9: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

• Source is node u.

Step 0 1 2 3

N' u

ux uxy

uxyv

D(v),p(v) 2,u 2,u 2,u

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

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

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

D(z),p(z) ∞ ∞ 4,y 4,y

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

9

Page 10: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

• Source is node u.

Step 0 1 2 3 4 5

N' u

ux uxy

uxyv uxyvw

uxyvwz

D(v),p(v) 2,u 2,u 2,u

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

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

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

D(z),p(z) ∞ ∞ 4,y 4,y 4,y

2

2

1 3

1

1

2

5 3

5

u

w

z

y x

v

10

Page 11: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm: Example

Resulting shortest-path tree from u:

v

x

y

w

z

(u,v)

(u,x)

(u,x)

(u,x)

(u,x)

Destination Link

Resulting forwarding table in u:

2

1

1

1

2

u

w

z

y x

v

11

Page 12: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Dijkstra’s algorithm

• Global routing algorithm:

– It takes the connectivity between all nodes and all link costs as inputs.

– Source u needs to have global knowledge of the network in order to determine its forwarding table.

12

Page 13: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Distance-Vector (DV) algorithm

• Decentralized algorithm:

– No node has complete information about the costs of all links.

– Each node begins with only the knowledge of the costs of its own directly attached links.

– Then, each node gradually calculates the least-cost path to a destination by exchanging information with its neighboring nodes.

13

Page 14: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

DV algorithm

• Each node x begins with an estimate Dx(y) of the cost of the least-cost path from itself to y, for all nodes. – Distance vector of x: Dx = [Dx(y): y є N ]

• Node x knows the cost c(x,v) for each neighbor v. • Neighbors exchange their distance vectors. • When x receives v’s distance vector, it uses Bellman-Ford

equation to update its own distance vector: – Dx(y) = minv{c(x,v) + Dv(y)} for each node y ∊ N

• If x’s distance vector changed, x sends its distance vector to its neighbors.

• If nodes continue exchanging updated distance vectors, each cost estimate Dx(y) will converge to the actual least-cost from x to y.

14

Page 15: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

fro

m

x y z

x

y

z

0 2 7

cost to

2 0 1

7 1 0

cost to

fro

m

x y z

x

y

z

0 2 7

2 0 1

3 1 0

x y z

x

y

z

0 2 3

fro

m

cost to

2 0 1

3 1 0

x y z

x

y

z

0 2 3 fr

om

cost to

3 1 0

2 0 1

x y z

x

y

z

0 2 3

fro

m

cost to

2 0 1 3 1 0

time

x y z

x

y

z

0 2 7

∞ ∞ ∞

∞ ∞ ∞

cost to fr

om

fr

om

x y z

x

y

z

∞ ∞

∞ ∞ ∞

cost to

x y z

x

y

z ∞ ∞ ∞

7 1 0

cost to

∞ 2 0 1

∞ ∞ ∞

time

1 2

7

node x table

node y table

node z table

fro

m

x y z

x

y

z

0

2 0 1

7 1 0

3 2

cost to fr

om

y

x z

15

Page 16: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Hierarchical Routing

• As the number of routers become large, the overhead involved in maintaining routing information becomes prohibitive.

• Internet providers want to manage their network as they wish, while still being able to connect to other networks.

• Organizing routers into autonomous systems (ASs) solve these problems.

16

Page 17: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Hierarchical Routing

• Routers within the same AS all run the same routing algorithm (e.g., Dijkstra or DV).

– Intra-AS routing protocol

• One or more routers in an AS are responsible to forward packets to destinations outside AS.

– Gateway routers

AS3

AS2

3b

3c

3a

AS1

1c

1a 1d

1b

2a 2c

2b

3b

3c

3a

2b

2c

2a 1b

1c

1a

1d

17

Page 18: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Hierarchical Routing

• How to route packets outside an AS?

• Inter-AS routing protocol:

– Obtain reachability information from neighboring ASs, and

– Propagate the reachability information to all routers in AS.

• In the Internet, all ASs run the same inter-AS routing protocol: BGP (Border Gateway Protocol)

– Uses a DV-like algorithm.

18

Page 20: Networking: Routing Algorithms - Cornell University Routing Algorithms Summer 2016 Cornell University Today •Dijkstra’s algorithm •Distance-Vector (DV) algorithm •Hierarchical

Coming up…

• Next lecture: Transport layer

• HW5:

– Released today

– Due on Wednesday

20


Recommended