Docsity

Understanding Dijkstra's and Bellman-Ford Routing Algorithms, Slides of Computer Science

Partial preview of the text

Download Understanding Dijkstra's and Bellman-Ford Routing Algorithms and more Slides Computer Science in PDF only on Docsity!

Routing Algorithms

Outline

Overview of Routing in the Internet

 Hierarchy and Autonomous Systems

Algorithms

 Naïve: Flooding  Distance vector: Distributed Bellman Ford Algorithm  Link state: Dijkstra’s Shortest Path First-based Algorithm

Interior and Exterior Routing Protocols

 Interior Routing Protocols: RIP, OSPF  Exterior Routing Protocol: BGP

Multicast Routing

Routing is a very complex subject, and has many aspects. Here, we will concentrate on the basics.

Routing Metrics

 Metrics

 Delay to send an average size packet (Make high speed links attractive, but closeness counts)  Bandwidth  Link utilization  Stability: Is a link (or path) up or down?

 Today: about 1/3 of Internet routes are

asymmetric

Example network

Objective: Determine the route from A to B that minimizes the path cost.

R 7

R (^11) R 2 1 R 4 4 R 6

2 4

2 2 3 2 3 R 8

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

A

B

R 5 R 3

So what about this network...!?

The public Internet in 1999

Learn more at http://www.lumeta.com

Routing in the Internet

The Internet uses hierarchical routing

 The Internet is split into Autonomous Systems (AS’s)  Examples of AS’s: Stanford (32), HP (71), MCI Worldcom (17373)  Try: whois –h whois.arin.net “MCI Worldcom”  Within an AS, the administrator chooses an Interior Gateway Protocol (IGP)  Examples of IGPs: RIP (rfc 1058), OSPF (rfc 1247).  Between AS’s, the Internet uses an Exterior Gateway Protocol  AS’s today use the Border Gateway Protocol, BGP-4 (rfc 1771)

Routing Algorithms

Technique 1: Naïve Approach

Advantages:  Simple.  Every destination in the network is reachable. Disadvantages:  Some routers receive a packet multiple times.  Packets can go round in loops as long as TTL>0.  Inefficient.

Flood! -- Routers forward packets to all ports except the ingress port. R 1

A Spanning Tree

R 3

R 1

R 5

R 4

R 8

R 6

 The solution is a spanning tree with R 8 as the root of the tree.  Tree: There are no loops.  Spanning: All nodes included.  We’ll see two algorithms that build spanning trees automatically:  The distributed Bellman-Ford algorithm  Dijkstra’s shortest path first algorithm

R 2

R 7

(^114)

2

4

2 2

3

2 3

Technique 2: Distance Vector

The Distributed Bellman-Ford Algorithm

1 2 7 8 0

8

  1. Let where: cost from to.
    1. Set
    2. Every seconds, router sends to its neighbors.
    3. If router is told of a lower cost path to , it updates

n (^) i i

i

X C , C , ..., C C R R

X

T i C

i R C

1

1

. Hence, where determines the next step improvement.

  1. If then goto step (3).
  2. Stop.

i n n

n n

X f X f X X

This is the “Distance vector”.

, for all i, to

Bellman-Ford Algorithm

R 3

R 5 R^7

R 8

R 1 R 2 R 4 R 6

(^114)

2 2 2

3

2 3 4

R 1 5, R 2 R 2 4, R 5 R 3 4, R 8 R 4 5, R 2 R 5 2, R 8 R 6 2, R 8 R 7 3, R 8

R 1 6, R 3 R 2 4, R 5 R 3 4, R 8 R 4 6, R 7 R 5 2, R 8 R 6 2, R 8 R 7 3, R 8

R 8

R 1 R 2 R 4 R 6

R 3 R^5

5 4 5 2

4 2

(^23) R 7

Solution

Bellman-Ford Algorithm

Questions:

1. How long can the algorithm take to run?

2. How do we know that the algorithm always

converges?

3. What happens when link costs change, or

when routers/links fail?

Topology changes make life hard for the

Bellman-Ford algorithm…

Counting to Infinity Problem

Solutions

  1. Set infinity = “some small integer” (e.g. 16). Stop when count = 16.
  2. Split Horizon: Because R 2 received lowest cost path from R 3 , it does not advertise cost to R 3
  3. Split-horizon with poison reverse: R 2 advertises infinity to R 3
  4. There are many problems with (and fixes for) the Bellman-Ford algorithm.

Technique 3: Link State

Dijkstra’s Shortest Path First Algorithm

 Routers send out update messages whenever the state of an incident link changes.  Called “Link State Updates”  Link State Updates are flooded throughout the network  Based on all link state updates received each router calculates lowest cost path to all others, starting from itself.  Use Dijkstra’s single-source shortest path algorithm  Assume all updates are consistent  At each step of the algorithm, router adds the next shortest (i.e. lowest-cost) path to the tree.  Finds spanning tree rooted at the router.