Docsity

Routing Algorithms: Dijkstra, Bellman-Ford vs. Real-World Implementations, Study notes of Computer Systems Networking and Telecommunications

Partial preview of the text

Download Routing Algorithms: Dijkstra, Bellman-Ford vs. Real-World Implementations and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

Network Layer:Routing algorithms

CS 242: Computer NetworksWeek 10: Monday, 11/12/07Daniel BilarWellesley CollegeFall 2007

Goals today ^ Ideal: Routing with Link State and Distance Vectorprotocols

^ Dijkstra ^ Bellman-Ford

^ Real world

^ Routers aggregated into hierarchies called Autonomous Systems ^ Use different algorithms inter- and intra-domain ^ Routing is (mostly) based on metrics (intra-domain) and policies(inter-domain)

^ BGP (Path Vector algorithm) is used interdomainSome slides adapted and pictures gratefully acknowledgedfrom Liebeherr, Rexford, Schul

Forwarding vs. Routing ^ Forwarding: data plane ^ Directing a data packet to an outgoing link ^ Individual router

using

a forwarding table

^ Routing: control plane ^ Computing paths the packets will follow ^ Routers talking amongst themselves ^ Individual router

creating

a forwarding table

Why Does Routing Matter? ^ End-to-end performance ^ Quality of the path affects user performance ^ Propagation delay, throughput, and packet loss ^ Use of network resources ^ Balance of the traffic over the routers and links ^ Avoiding congestion by directing traffic to lightly-loaded links ^ Transient disruptions during changes ^ Failures, maintenance, and load balancing ^ Limiting packet loss and delay during changes

Graph abstraction: costs

u

y

x

w

v

z

  • c(x,x’) = cost of link (x,x’)- e.g., c(w,z) = 5• cost could always be 1, orinversely related to bandwidth,or inversely related tocongestion

Cost of path (x

, x, x 12

,…, x 3

) = c(xp

,x) + c(x 12

,x) + … + c(x 23

,xp-1p

Question: What’s the least-cost path between u and z? Routing algorithm: algorithm that finds least-cost path

Internet routers ^ ‘Traffic cops’ of networks ^ Must decide where to send packets ^ Decisions are reflected in routing tables which must be computed

5555 2222

1111

2222

3333 3333 1111

5555 2222

1111

BBBB

AAAA

CCCC^

DDDD EEEE

FFFF

source hostsource hostsource hostsource host

destination hostdestination hostdestination hostdestination host

firstfirstfirstfirst----hop routerhop routerhop routerhop routerdefault routerdefault routerdefault routerdefault router

source routersource routersource routersource router

destination routerdestination routerdestination routerdestination router leastleastleastleast----cost path

cost pathcost pathcost path

Routing algorithm: Dijkstra ^ “Tells world about the neighbours ”

^ Each node assumed to know state of links to its neighbors

^ Step 1: Flooding

^ Each node ‘broadcasts’ its state to all other nodes, a so-calledLink State Packet (LSP) ^ Node ID, List of neighbors and link cost, Time to live (TTL), andmore ^ Node outputs LSP on all its links

^ Step 2: Dijkstra’s shortest path tree

^ Each node computes shortest paths to all other nodes fromglobal state ^ Dijkstra’s shortest path tree (SPT) algorithm

^ Requires

global

information

^ Wide-spread Internet routing protocol that uses thisalgorithm is OSPF

Algorithm (at Node X) ^ Initialization ^ N = {X} ^ For all nodes V ^ If V adjacent to X, D(V) = C(X,V) else D(V) = ∞ ^ Loop ^ Find U not in N such that D(U) is smallest ^ Add U into set N ^ Update D(V) for all V not in N ^ D(V) = min{D(V), D(U) + C(U,V)} ^ Until all nodes in N

B G

C H

D

A^

F

E

(2,A)

(6,A)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

∞ 6 ∞ ∞ ∞ ∞ 2 0 A

H G F E D C B A

C(x,y)

Choosing A.Updating D(x).D(B) smallest, nextnode is B Routing table for A

B G

C H

D

A^

F

E

(2,A)

(9,B)

(4,B)

(6,A)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

∞ 6 ∞ 4 ∞ 9 2 0 A

H G F E D C B A

C(x,y)

Choosing B.Updating D(x)D(E) is smallest,so next node is E

Routing table for A

B G

C H

D

A^

F

E

(2,A)

(9,B)

(4,B)

(6,E)

(9,G)

(5,E)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

9 5 6 4 ∞ 9 2 0 A

H G F E D C B A

C(x,y)

Choosing G.Updating D(x).D(F) is smallest,next node is F.

Routing table for A

B G

C H

D

A^

F

E

(2,A)

(9,B)

(4,B)

(6,E)

(8,F)

(5,E)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

8 5 6 4 ∞ 9 2 0 A

H G F E D C B A

C(x,y)

Choosing F.Updating D(x).D(H) is smallest,next node is H.Notice howD(H) changedfrom 9 to 8.

Routing table for A

B G

C H

D

A^

F

E

(2,A)

(9,B)

(4,B)

(6,E)

(10,H)

(8,F)

(5,E)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

A

H G F E D C B A

C(x,y)

Choosing C.Updating D(x) ...No D(x) getschanged, Cmust not be on ashortest pathfrom A to anyother node!Last node is D.

Routing table for A

B G

C H

D

A^

F

E

(2,A)

(9,B)

(4,B)

(6,E)

(10,H)

(8,F)

(5,E)

0 4 2 ∞ 2 ∞ ∞ ∞ H

4 0 ∞ 1 ∞ ∞ ∞ 6 G

2 ∞ 0 2 ∞ 3 ∞ ∞ F

∞ 1 2 0 ∞ ∞ 2 ∞ E

2 ∞ ∞ ∞ 0 3 ∞ ∞ D

∞ ∞ 3 ∞ 3 0 7 ∞ C

∞ ∞ ∞ 2 ∞ 7 0 2 B

A

H G F E D C B A

C(x,y)

Choosing D.Updating D(x) ..Nothing toupdate since allnodes marked

We are done!Routing table for A