SET 8a Rout outing ing Algor lgorit ithms hms 1 Network Layer - - PDF document

set 8a
SMART_READER_LITE
LIVE PREVIEW

SET 8a Rout outing ing Algor lgorit ithms hms 1 Network Layer - - PDF document

CMPE 252: Computer Networks SET 8a Rout outing ing Algor lgorit ithms hms 1 Network Layer The main functions at the network layer are addressing, routing, congestion control, and admission control. Addressing consists of


slide-1
SLIDE 1

1

1

CMPE 252: Computer Networks

SET 8a Rout

  • uting

ing Algor lgorit ithms hms

2

Network Layer

 The main functions at the network layer are addressing,

routing, congestion control, and admission control.

 Addressing consists of identifying where a destination is

with respect to the network topology.

 Routing consists of (a) computing paths from sources to

destinations and (b) forwarding packets along such paths.

 Congestion control consists of limiting the amount of data

a source can sent into the network.

 Admission control consists of limiting the number of

sources allowed to send data into the network, and in a way is part of system-wide congestion control.

3

Routing

 Algorithms used to compute paths from sources

to destinations can be:

 Static or adaptive: Routers compute paths off-line or

dynamically in response to changes in topology or even traffic.

 Hierarchical or flat (heterarchical): Routers and

hosts are organized into clusters of nodes or all destinations and routers are treated as peers.

 On-demand or table-driven: Routers maintain

routing information for only those destinations for which need to forward data, or for all destinations.

 You will also see routing algorithms classified

according to the type of information they use.

slide-2
SLIDE 2

2

4

Routing Algorithms

 Most books and papers classify routing algorithms into

distance-vector and link-state algorithms.

 Distance-Vector Algorithm: Routers exchange their

distances to known destinations; a router uses the distance vectors received from its neighbors to compute its own distances. Computation is distributed.

 Link-State Algorithm: Routers exchange information

about the state of the links in the network; a router uses this information to compute its distances to destinations. Computation is local.

 Doesn’t this sound a bit like the

“Tastes Great/Less Filling” argument?

5

Similar Type of Classification Applies to Horses!

Horses could classify horses as:

Horses with no PJs Horses with PJs

Unfortunately, zebras are not horses! :)

6

So What Does This have to Do with Routing Algorithms?

 A routing algorithm is not solely defined by the

type of information maintained at routers.

 Some information must be disseminated

throughout the network, which necessarily involves a distributed computation.

slide-3
SLIDE 3

3

7

Routing Algorithms

Routing algorithms should be classified according to:

1.

The type of search they support

2.

The mechanism(s) used to detect that the operations executed in the search complete successfully or not.

3.

The entities for which routes are built

4.

The identifiers used to denote such entities.

Routing algorithms (protocols) today assume

BFS, nodes/networks as destinations, globally unique pre-defined identifiers.

We first address the mechanisms used to detect the completion of operations supporting such a search.

8

Routing Algorithms

 A routing algorithm always carries out a distributed

computation to obtain correct paths from each source to its desired destinations.

 Some indication that at least some aspect of this computation

has ended must be available to routers.

 The end of any distributed computation can be detected in

three known ways (and combinations of them):

 Termination detection over a tree  Termination detection using sequence numbers (time

stamps)

 Termination detection over a ring  Distances or link states can be used in each of these three

types of algorithms! A good read: Nancy Lynch, “Distributed Algorithms,” Morgan Kaufman, 96

9

Shortest-Path Routing

Problem: Compute the path of minimum length from each router to each destination

Notation: G(N, E) is the network of |N| nodes and |E| links

i k

l

(i, k)

) , (

1 hop + ∈ ∀ ∑

=

i P h i i j

h h l D

i j i

p j h2 hx

….

k i q i j

P

i

N

slide-4
SLIDE 4

4

10

Bellman-Ford Algorithm

 BF iterates on the number of hops away from a node. S A B D E C 1 5 2 10 2 2 1 10 5 Step 1: Initialize source node S with a 0 distance to itself and all other nodes with an infinite distance. Step 2: Set H = 1 Step 3: Label all nodes H hops away from S with the smallest distance from S to the nodes. Step 4: Stop if all nodes have been covered and no label can be reduced by increasing H. Else, set H = H+1 and repeat Step 3 Link costs are the same in both link directions

∞ ∞ ∞ ∞ ∞

11

Bellman-Ford Algorithm

S A B D E C 1 5 2 10 2 2 1 10 5

H = 1:

∞ ∞ ∞

1, 1 1 5, 1 1

Only A and B can be reached within one hop

12

Bellman-Ford Algorithm

S A B D E C 1 5 2 10 2 2 1 10 5

H = 2:

1, 1 1 5, 1 1

A, B, C and D can be reached within two hops

7, 2 6, 2

slide-5
SLIDE 5

5

13

Bellman-Ford Algorithm

S A B D E C 1 5 2 10 2 2 1 10 5

H = 2:

1, 1 1

B, C and D are relabeled. We need to increase H to cover E and reduce labels.

11, 2

  • -, 2

3, 2 5, 1

14

Bellman-Ford Algorithm

S A B D E C 1 5 2 10 2 2 1 10 5

H = 3:

1, 1 1

All nodes are labeled. E cannot have a valid label with H = 3

11, 2 3, 2 5, 1

  • -, 3
  • -, 2

4, 3 5, 3

15

Bellman-Ford Algorithm

H = 4:

S A B D E C 1 5 2 10 2 2 1 10 5 1 3 5 4

No more nodes can be reached and no label can be reduced

7 4

Increase H to 4

slide-6
SLIDE 6

6

16

Distributed Bellman-Ford Algorithm (DBF)

 The objective of DBF is to have a distributed

implementation of BF, so that routers can compute distances to destinations distributedly.

 To accomplish this, the computation of a distance to a

destination starts at the destination itself.

 The iteration of DBF is on the number of hops away from

a destination.

 DBF operates independently for each destination.  Destination starts by stating the distance to itself is 0  The neighbors of the destination receive this information,

process it and send their own updates.

 Distances propagate throughout the network.

17

Notation

i k

l

(i, k)

k j

D

p j k i q

p j

D

q j

D

i jk

D

i k i jk i j

l D D + =

successor for j: i

j

s

Node i must compute the shortest distance to j, which we show to be through neighbor k

18

DBF

 Information maintained at each router:

 Distance Table: Distance to each destination reported

by each neighbor

 Link-Cost Table: Cost of link to each adjacent node  Routing Table: Distance and successor (next hop) to

each destination

 Information exchanged among routers:

 Vector of one or more entries, each entry stating the

distance to a destination

 Services assumed:

 Update messages are exchanged reliably, a node

knows who its neighbors are

slide-7
SLIDE 7

7

19

DBF

Router I computes every time it receives an input event (link change or update message) and sends an update message to its neighbors.

i k

l

(i, k)

k j

D p j k i q

p j

D

q j

D

i jk

D

i k i jk i j

l D D + =

i j

s

i j

D

{ }

|

i i p i jp i j

N p l D Min D ∈ + =

is computed with the Bellman-Ford Equation:

i j

D The next hop for j is a neighbor that provides the minimum distance according to the Bellman-Ford equation.

20

Example of DBF Operation

 For simplicity, we will assume “synchronous operation” in all

cases!

2 3 4 1 2 2 3 3 4 4 time 1 1 d c j a b 1 1 1 1

21

Counting to Infinity in DBF

 The problem with DBF is that it does not have a

termination detection mechanism!

d c j a b 1 2 3 4 X 3 = 2+1 4 = 3+1 4 5 5 5 6 6 6 6 7 7 7

…. etc

time

slide-8
SLIDE 8

8

22

Correctness of DBF

Note that BF can only converge if H is finite!

Step 1: Initialize source node S with a 0 distance to itself and all

  • ther nodes with an infinite

distance. Step 2: Set H = 1 Step 3: Label all nodes H hops away from S with the smallest distance from S to the nodes. Step 4: Stop if all nodes have been covered and no label can be reduced by increasing H. Else, set H = H+1 and repeat Step 3 S A B D E C 1 5 2 10 2 2 1 10 2 1 3 5 4 6 partition

After partition, the max H from S to E is infinity! S can keep max number of nodes in the network (N), and the distance and hop count for each destination. S can stop when hop count = N, because longest path must be N-1 hops.

23

Ad Hoc Solutions

(do not work)

Counting to N takes too long! Alternatives include:

 Split horizon: Tell successor distance to destination is

infinity.

 Hold-down timer: After distance to destination

increases, send update stating new distance through current successor, wait for a long period of time before computing new successor and shortest distance and then act as in DBF.

 Poisoned reverse: After distance increase, report an

infinite distance and then correct the distance.

 Next-hop information: Communicate the distance and

next hop to each destination (used in RIP v2)

24

DBF Correctness

 Liveness:

 Each node updates its routing table independently of

  • thers.

 The only possibility of deadlock occurs in the reliable

exchange of update messages (the equivalent of a point-to-multipoint ARQ)

 Safety:

 We must show that, in the absence of deadlocks and

after an arbitrary sequence of topology changes, the protocol produces correct routing tables and stops sending updates.

slide-9
SLIDE 9

9

25

DBF Correctness

Assumptions:

 We focus on the min-hop routing case.  G is connected (max hop count is finite).  No more topology changes occur after time t.  No deadlocks occur in the exchange of

correct update messages. We can show that the exchange of messages does not produce a deadlock.

26

DBF Correctness: DBF Obtains Correct Routing Tables

 Proof is by simple induction on the number of

hops away from a destination j.

 Because of the underlying service, a neighbor of

j knows that j is a neighbor within a finite time, and sets its distance to j equal to 1 by some time T0 ≥ t

 Assume that DBF is correct for h – 1 hops away

from j.

27

 By time T1 > T0, each router h – 1 hops away from

destination j must send an update message reliably to each neighbor stating that its distance to j is h – 1.

 Consider router x, which is h hops away from j. This

router must know all its neighbors within a finite time, and must receive the update from all its neighbors at h – 1hops from j by time T1.

 Whatever the distance to destination j for node x (at h

hops from j) is, using the BF equation, node x must choose a neighbor h – 1 hops from j as its next hop to j by some finite time T2 > T1. Q.E.D.

DBF Obtains Correct Routing Tables

slide-10
SLIDE 10

10

28

DBF Correctness: DBF Stops

 A router updates the distance to a destination only

after topology changes or update messages are received, and no more topology changes occur after time t.

 A router sends an update message only if its distance

changes.

 After node i (which is h hops away from j) sends its

update stating that its distance to j is h, it does not send more updates (this requires that a router must continue using the same next hop unless its distance changes!)

 Therefore, DBF stops.

29

Bad News: Looping in DBF

S A B D j C 1 5 2 10 2 2 1 10 2

2, j 2, j 0, j 3, D 5, B 6, A

X

30

Looping in DBF

S A B D C 1 5 2 10 2 1 10

3, D 5, B 6, A 5,B

5

4, B

4

slide-11
SLIDE 11

11

31

Looping in DBF

S A B D C 1 5 2 10 2 1 10

3, D 5, B 6, A 5,B 4, B

5 … etc

Erroneous paths persist as long as they appear to be the shortest paths. Similar looping could occur if the cost of the links to j increased drastically (e.g., to 20). DBF cannot be used with link costs that have a large variance!

32

Examples of DBF Use

 First routing protocol of the ARPANET.  Routing protocol of MERIT network.  DARPA packet radio network.  Routing Information Protocol (RIP)  RIPv2  Cisco’s IGRP (DBF with split horizon, poison

reverse, hold downs, and a complex link-cost metric).

33

Termination Detection Using Sequence Numbers

 Examples using link-state information are the

traditional link-state routing protocols:

 OSPF, IS-IS, new ARPANET routing protocol.

 Examples using distance information:

 DSDV (Destination Sequenced Distance Vector

protocol, ACM SIGCOMM 94).

 AODV (Ad-hoc On Demand Distance Vector protocol,

IETF Draft).

slide-12
SLIDE 12

12

34

Termination Detection Using Sequence Numbers

Approach:

 An update source is defined  Source of update increments sequence number with

each update it originates.

 Update is flooded reliably throughout the network.  A node trusts an update it receives if it has a higher

sequence number than the node’s local copy.

 Mechanisms needed to account for node faults and

network partitions.

35

Example: Traditional Link-State Algorithm (LSA)

 Developed as a result of DBF’s looping and non-

termination problems.

 Two components:

 Topology map distribution  Local shortest path computation

 Each router runs a local shortest-path algorithm

(Dijkstra’s) using the topology stored locally.

 Flooding is used to replicate the topology map at every

router.

 Each router is responsible for reporting the state of

  • utgoing links to the rest of the network.

 Two link-state updates per link reach every router.

36

Shortest-Path First (SPF) Algorithm

Step 1: Initialize Set SPF = { root }, where root is router running SPF Distance to root = 0 and distance to other node = cost of link or infinity Step 2: Find next node for SPF set: Find a node x not in SPF set such that: distance to/from root = Min{distance to node outside of SPF set} Augment SPF set with x Stop if SPF set contains all nodes Step 3: Change minimum distance: For each node y outside SPF set do:

  • dist. to y = Min{ dist. to y, dist. to z in SPF + cost of (z, y) }

Repeat Step 2

slide-13
SLIDE 13

13

37

SPF Example

SPF ={S}

S A B D E C 1 5 2 10 2 2 1 10 2 1 5

∞ ∞ ∞

38

SPF Example

SPF ={S, A}

S A B D E C 1 5 2 10 2 2 1 10 2 1

∞ ∞ ∞

11 3

39

SPF Example

SPF ={S, A, B}

S A B D E C 1 5 2 10 2 2 1 10 2 1

∞ ∞ ∞

3 5 4

slide-14
SLIDE 14

14

40

SPF Example

Note that iteration is on the next node that can be covered with the next shortest path; hence complete topology must be known by router…. But maybe just some topology is needed! SPF ={S, A, B, D}

S A B D E C 1 5 2 10 2 2 1 10 2 1

3 5 4 6 Labels do not change as we continue to expand SPF set

SPF ={S, A, B, D, C} then SPF ={S, A, B, D, C, E}

Stop after covering E since all nodes are covered by SPF set.

41

Flooding of Link States

 Information Stored at Routers:

 Each router maintains all the nodes and all the links in the network in a

topology graph.

 Each link in the graph has a cost, a sequence number, and an age.

 Information Exchanged:

 Each router is responsible for communicating the latest state of each

adjacent outgoing link.

 The router sends a link state update (LSU) to report changes on an

adjacent outgoing link.

 A sequence number is used to identify the latest LSU.  An LSU also specified the age of the LSU, and the age of an LSU is

decremented each time it is forwarded and while it is in storage.

We assume that LSUs are exchanged reliably between any two routers and that a router knows who its neighbors are!

42

Link-State Flooding Example

S A B D E C 1 5 2 10 2 2 1 10 2

slide-15
SLIDE 15

15

43

Link-State Flooding Example

S D E C 1 5 2 10 2 2 1 10 2 B A

Each link has a cost in each direction.

44

Link-State Flooding Example

S D E C 1 7 2 10 2 2 1 10 2 B A

Node S is responsible for reporting changes in the state of its

  • utgoing

links

45

Link-State Flooding Example

S A B D E C 1 7 2 10 2 2 1 10 2

LSU:

l(S,B) = 7 SN = 1 AGE = max

slide-16
SLIDE 16

16

46

Link-State Flooding Example

S A B D E C 1 7 2 10 2 2 1 10 2

LSU:

l(S,B) = 7 SN = 1 AGE = max - 1

LSU:

l(S,B) = 7 SN = 1 AGE = max - 1

47

Link-State Flooding Example

S A B D E C 1 7 2 10 2 2 1 10 2

LSU:

l(S,B) = 7 SN = 1 AGE = max - 2

LSU:

l(S,B) = 7 SN = 1 AGE = max - 2

48

Link-State Flooding Example

S A B D E C 1 7 2 10 2 2 1 10 2

LSU:

l(S,B) = 7 SN = 1 AGE = max - 3

slide-17
SLIDE 17

17

49

Flooding of LSUs

Rule 1: Deleting old LSUs

 A router discards an LSU in its topology graph

when it reaches a maximum age (min. age).

 A router transmits periodically an LSU for each of

its outgoing links, and assigns a 0 (max) age and the highest sequence number to the LSU.

 The router originating an LSU is the only one that

can change the sequence number of the LSU.

50

Flooding of LSUs

Rule 2: Propagating LSUs

 A router that receives a more recent LSU with a valid

age from a given neighbor propagates it to all its

  • ther neighbors.

 A router that receives an outdated LSU from a

neighbor discards the LSU received and sends its more recent LSU to the neighbor (this corrects the neighbor).

 A router that receives a more recent LSU with a zero

age propagates the LSU to all its other neighbors if the link is in its topology graph and deletes the link from its topology graph; else, it ignores the LSU.

51

Flooding of LSUs

 Rule 3: Handling Topology Changes  A router that detects a new neighbor sends

its topology graph to that neighbor.

 A router that hears a more recent LSU from a

neighbor for one of its outgoing links creates a new LSU with a higher sequence number and sends it to all its neighbors.

slide-18
SLIDE 18

18

52

Flooding of LSUs

 The distributed computation consists of

disseminating the latest state of each link to every node in the network reliably in the presence of topology changes.

 The local computation (computing shortest

paths) is simple.

53

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

Assume all nodes have SN = 100 for link (S,A).

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100

54

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

E reboots and resets its SN for all its outgoing links. Now: SN (S,A) = 1 at S!

SN (S,A) = 100 SN (S,A) = 100

slide-19
SLIDE 19

19

55

Need for Link-State Resets

S A B D E C 10 5 2 10 2 2 1 10 2

(S,A) changes to 10 and S sends an LSU LSU:

l(S,A) = 10 SN = 1 AGE = max SN (S,A) = 100 SN (S,A) = 100

56

Need for Link-State Resets

S A B D E C 10 5 2 10 2 2 1 10 2

A and B cannot trust the LSU from S!

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 1

57

Need for Link-State Resets

S A B D E C 10 5 2 10 2 2 1 10 2

However, they send a correcting LSU to S with the higher SN. LSUs from A & B:

l(S,A) = 1 SN = 100 AGE = value SN (S,A) = 100 SN (S,A) = 100

slide-20
SLIDE 20

20

58

Need for Link-State Resets

S A B D E C 10 5 2 10 2 2 1 10 2

S can now send an LSU for (S,A) that all nodes can trust. LSU:

l(S,A) = 10 SN = 101 AGE = max SN (S,A) = 100 SN (S,A) = 100

Source of LSUs is reset to higher SN value

59

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

Assume all nodes have SN = 100 for link (S,A) and the max SN is 101.

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100

How can S recycle SNs?

60

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

Simple! Erase higher SNs using the age field.

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100

slide-21
SLIDE 21

21

61

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100

LSU:

l(S,B) = 5 SN = 101 AGE = 0

62

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

SN (S,A) = 100 SN (S,A) = 100 SN (S,A) = 100

LSU:

l(S,B) = 5 SN = 101 AGE = 0

LSU:

l(S,B) = 5 SN = 101 AGE = 0

63

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

SN (S,A) = 100

LSU:

l(S,B) = 5 SN = 101 AGE = 0

LSU:

l(S,B) = 5 SN = 101 AGE = 0

slide-22
SLIDE 22

22

64

Need for Link-State Resets

S A B D E C 1 5 2 10 2 2 1 10 2

LSU:

l(S,B) = 5 SN = 101 AGE = 0

All nodes but S have erased their records of (S,A) and can start accepting LSUs with SN =1 for link (S,A).

Record of a link state is reset at every node

  • ther than the source.

65

Correctness of LSA

 The fact that LSA works correctly is intuitive.  The correctness of LSA is easily shown by induction on the

number of hops away from the origin of an LSU:

 Assume that local shortest-path algorithm is correct;

assume that neighbors exchange LSUs reliably without deadlocks; assume that topology remains static after an arbitrary sequence of changes.

 Argue that each LSU propagates independently of

  • thers; focus on one LSU and show that it propagates

to the farthest node in the network.

 Show that nodes that fail and come back up, or

components that reconnect, eliminate old LSUs by means of Rule 3.

66

Limitation of Approaches based on Sequence Numbering

 Approaches based solely on sequence numbers

incur substantial communication and processing

  • verhead (to flood link states or distances).

 Approach can be used using distances and

distance flooding

 This is more expensive than link-state flooding  It can provide instantaneous loop freedom.

slide-23
SLIDE 23

23 Food for Thought: Adding Sequence Numbers in DBF

 Destination j adds a sequence number (snj j) to its updates.  sni j denotes the sequence number for destination j assumed by i.  Node i sends updates stating Di j and sni j  Only the destination can change the sequence number for itself.  sni jk denotes the sequence number for destination j reported by

node k to node i.

 A node i can select neighbor k as a next hop to destination j only

if the following statements are true:

1.

Di

jk + li k = Min{Di jm + li m | m in Ni } 2.

( Di

jk < Di j and sni jk = sni j ) or sni jk > sni j  How could this work?

67 68