Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
87 views40 pages

Chapter 4 - Routing Concept

The document discusses routing concepts and the distance vector routing algorithm. It describes how the distance vector algorithm works iteratively with each router sharing only its routing information with directly connected neighbors. Each router maintains a distance table to track the least cost path to all destinations and periodically updates its neighbors if the least cost path changes. The algorithm converges over multiple iterations as routers exchange and update their routing information.

Uploaded by

Divesha Ravi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views40 pages

Chapter 4 - Routing Concept

The document discusses routing concepts and the distance vector routing algorithm. It describes how the distance vector algorithm works iteratively with each router sharing only its routing information with directly connected neighbors. Each router maintains a distance table to track the least cost path to all destinations and periodically updates its neighbors if the least cost path changes. The algorithm converges over multiple iterations as routers exchange and update their routing information.

Uploaded by

Divesha Ravi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Chapter 4

Routing Concepts

1
Network Layer Functions
transport packet from sending
to receiving hosts
application
network layer protocols in every transport
network
host, router data link network
physical data link
network network
data link physical data link
physical physical

path determination: route taken network


data link
by packets from source to dest. physical network
data link
Routing algorithms physical

switching: move packets from network


network
data link
router’s input to appropriate data link physical
physical
router output network
application
call setup: some network data link
physical transport
architectures require router call network
data link
setup along path before data physical

flows

2
Interplay between routing and forwarding

routing algorithm

local forwarding table


header value output link
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

3
Graph abstraction

5
3
v w 5
2
u 2 1 z
3
1 2
Graph: G = (N,E)
x 1
y

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

4
Graph abstraction: costs

5
• c(x,x’) = cost of link (x,x’)
3
v w 5
2 - e.g., c(w,z) = 5
u 2 1 z
3 • cost could always be 1, or
1 2 inversely related to bandwidth,
x 1
y
or inversely related to
congestion

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

5
Routing

Routing protocol
Goal: determine “good” path 5
(sequence of routers) thru 3
network from source to dest. B C 5
2
A 2 1 F
Graph abstraction for routing 3
1 2
algorithms: D E
1
graph nodes are routers
graph edges are physical
links “good” path:
• typically means minimum
• link cost: delay, $ cost, or
cost path
congestion level
• other definitions possible

6
Routing Algorithm Classification

Global or decentralized Static or dynamic?


information? Static:
Global: routes change slowly over time
all routers have complete Dynamic:
topology, link cost info routes change more quickly
“link state” algorithms • periodic update
Decentralized: • in response to link cost
changes
router knows physically-
connected neighbors, link
costs to neighbors
iterative process of
computation, exchange of info
with neighbors
“distance vector” algorithms

7
Distance Vector Routing Algorithm (Old Arpanet
Routing or Bellman-Ford)

iterative:
continues until no nodes Distance Table data structure
exchange info. each node has its own
self-terminating: no row for each possible destination
“signal” to stop column for each directly-attached
neighbor to node
asynchronous: example: in node X, for dest. Y via
nodes need not exchange neighbor Z:
info/iterate in lock step!
distributed:
each node communicates distance from X to
only with directly- X = Y, via Z as next hop
attached neighbors D (Y,Z)
Z
= c(X,Z) + minw{D (Y,w)}

8
Distance Table: Example

1 cost to destination via


B C E
7 D () A B D
A 8 2
1 A 1 14 5
E D
2
B 7 8 5

destination
E D
D (C,D) = c(E,D) + minw {D (C,w)}
= 2+2 = 4 C 6 9 4
E D
D (A,D) = c(E,D) + min {D (A,w)}
w D 4 11 2
= 2+3 = 5 loop!
E B
D (A,B) = c(E,B) + minw{D (A,w)}
= 8+6 = 14
loop!
9
Distance table gives routing table

cost to destination via


E Outgoing link
D () A B D to use, cost

A 1 14 5 A A,1

B 7 8 5 B D,5
destination

destination
C 6 9 4 C D,4

D 4 11 2 D D,4

Distance table Routing table

10
Distance Vector Routing: Overview

Iterative, asynchronous: each


local iteration caused by: Each node:
local link cost change
message from neighbor: its least wait for (change in local link
cost path change from neighbor cost or message from neighbor)
Distributed:
each node notifies neighbors
only when its least cost path to
any destination changes Recompute distance table
• neighbors then notify their
neighbors if necessary
if least cost path to any dest has
changed, notify neighbors

11
Distance Vector Algorithm

At all nodes, X:
1 Initialization:
2 for all adjacent nodes v:
3 D X(*,v) = infty /* the * operator means "for all rows" */
X
4 D (v,v) = c(X,v)
5 for all destinations, y
X
6 send min D (y,w) to each neighbor /* w over all X's neighbors */
w

12
Distance Vector Algorithm (cont.):
8 loop
9 wait (until I see a link cost change to neighbor V
10 or until I receive update from neighbor V)
11
12 if (c(X,V) changes by d)
13 /* change cost to all dest's via neighbor v by d */
14 /* note: d could be positive or negative */
15 for all destinations y: D X(y,V) = DX(y,V) + d
16
17 else if (update received from V wrt destination Y)
18 /* shortest path from V to some Y has changed */
19 /* V has sent a new value for its min w DV(Y,w) */
20 /* call this received new value is "newval" */
21 for the single destination y: D X(Y,V) = c(X,V) + newval
22
23 if we have a new min w D X (Y,w) for any destination Y
24 send new value of min w D X (Y,w) to all neighbors
25
26 forever 13
Distance Vector Algorithm: example

Y
2 1
X Z
7

14
Distance Vector Algorithm: example

Y
2 1
X Z X Z
7 D (Y,Z) = c(X,Z) + minw{D (Y,w)}
= 7+1 = 8

X Y
D (Z,Y) = c(X,Y) + minw {D (Z,w)}
= 2+1 = 3

15
Distance Vector: link cost changes

Link cost changes:


node detects local link cost change 1
Y
updates distance table (line 15) 4 1
if cost change in least cost path, X Z
50
notify neighbors (lines 23,24)

algorithm
terminates
“good
news
travels
fast”

16
Distance Vector: link cost changes

Link cost changes:


60
good news travels fast Y
4 1
bad news travels slow -
X Z
“count to infinity” problem! 50

algorithm
continues
on!

17
What to do -- Split Horizon
If router R forwards traffic for destination D thru
neighbor N, then R reports to N that R’s distance to D
is infinity.
Because R is routing traffic for D thru N, R’s real
distance to N cannot simply matter to N.
Works in the previous case but does not work in some
cases
R2 R3
Example
R1

The count-to-infinity problem still exists


18
Distance Vector: Poison Reverse

If Z routes through Y to get to X :


60
Z tells Y its (Z’s) distance to X is infinite (so Y
Y
won’t route to X via Z) 4 1
will this completely solve count to infinity X Z
problem? 50

algorithm
terminates

19
Link State Routing
Each router is responsible for meeting its neighbours and
learning their names
Each router constructs a packet known as link state packet, or
LSP, which contains a list of names of and cost to each of its
neighbours
• A router generates an LSP periodically as well as when R discovers
that
 it has a new neighbour

 the cost of a link to a neighbour has changed

 a link to a neighbour has gone down

The LSP is somehow transmitted (this is the most complex and


critical piece) to all other routers and each router stores the
most recently generated LSP from each other router
Each router armed now with a complete map of the topology,
computes routes to each destination.

20
Disseminating the LSP to all Routers
A simple scheme for routing that does not depend
having any routing info is flooding, in which each
packet received is transmitted to each neighbour
except the one from which the packet is received.
Also let the packet have a hop count.
A better and simple LSP distribution scheme is as
follows:
• If an LSP is received from neighbour N with source S and if
the LSP is identical to the one from S that is stored, then
ignore the received LSP (it is a duplicate)
• If the received LSP is not identical to the one from S
currently stored or no LSP from S is stored, store the
received LSP and transmit it to all neighbours
• The problem is that router cannot assume that the LSP most
recently received from S is the one most recently generated.
• Use sequence number/age schemes

21
Sequence number/age Schemes
A sequence number is a counter
Each router S keeps track of the sequence number it
used the last time it generated an LSP; when S needs
to generate a new LSP, it uses the next sequence
number
When router R receives an LSP from from S, router R
compares sequence number of the received LSP with
the one from S stored in memory and assumes that
the the one with the higher sequence number is the
more recently generated.
Problem 1. Sequence number field is of finite size
• Wrap around, count as 0,1,…,n-1,n,0,1,…
• How would you compare two sequence numbers a and b in this
framework?

22
Sequence number/age schemes

>a

<a
n-1 0 1
n

23
Sequence number/age schemes
What happens if router S goes down and forgets the
sequence number it was using? If it starts at 0 again,
will its LSPs be believed by the network, or will they
look older than the LSPs that S had issued before?
To solve this problem, a second field, known as the age
of the LSP is added to each LSP packet.
It starts at some value and is decremented by routers
as it is held in memory.
When an LSP’s age reaches 0, the LSP can be
considered too old, and an LSP with a nonzero age is
accepted as newer regardless of its sequence number.
LSP distribution scheme intelligently uses age and
sequence number for dissemination of LSPs; used in
IS-IS, OSPF, and PNNI.
24
A Link-State Routing Algorithm

Dijkstra’s algorithm Notation:


net topology, link costs known c(i,j): link cost from node i to j.
to all nodes cost infinite if not direct
neighbors
• accomplished via “link
D(v): current value of cost of
state broadcast”
path from source to dest. v
• all nodes have same info
p(v): predecessor node along
computes least cost paths path from source to v, that is
from one node (‘source”) to next v
all other nodes N: set of nodes whose least cost
• gives routing table for path definitively known
that node
iterative: after k iterations,
know least cost path to k
dest.’s

25
Dijsktra’s Algorithm -- Shortest Path

1 Initialization:
2 N = {A}
3 for all nodes v
4 if v adjacent to A
5 then D(v) = c(A,v)
6 else D(v) = infty
7
8 Loop
9 find w not in N such that D(w) is a minimum
10 add w to N
11 update D(v) for all v adjacent to w and not in N:
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N

26
Dijkstra’s algorithm: example

Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)


0 A 2,A 5,A 1,A infinity infinity
1 AD 2,A 4,D 2,D infinity
2 ADE 2,A 3,E 4,E
3 ADEB 3,E 4,E
4 ADEBC 4,E
5 ADEBCF

5
3
B C 5
2
A 2 1 F
3
1 2
D E
1

27
Dijsktra’s Algorithm -- Widest Path

1 Initialization:
2 N = {A}
3 for all nodes v
4 if v adjacent to A
5 then D(v) = b(A,v) /* b(A,v) is the available bandwidth*/
6 else D(v) = 0
7
8 Loop
9 find w not in N such that D(w) is a maximum
10 add w to N
11 update D(v) for all v adjacent to w and not in N:
12 D(v) = max[ D(v), min(D(w),b(w,v)) ]
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N

28
Dijkstra’s algorithm -- Widest Path

Step start N D(B),p(B) D(C),p(C) D(D),p(D D(E),p(E) D(F),p(F)


0 A 2,A 5,A ) 0 0
1 AC 3,C 1,A 1,C 5,C
2 ACF 3,C 3,C 2,F
3 ACFB 3,C 2,F
4 ACFBD 3,C 2,F
5 ACFBDE

5
3
B C 5
2
A 2 1 F
3
1 2
D E
1

29
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(n^2)
more efficient implementations possible: O(n logn)
Oscillations possible:
e.g., link cost = amount of carried traffic

1 A A A A
1+e 2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0 1 1+e 0 e
1
C C C C
1
e
… recompute … recompute … recompute
initially
routing
30
Comparison of LS and DV algorithms
Message complexity and memory
Robustness: what happens if
LS: with n nodes, E links, O(nE)
messages sent each, larger tables router malfunctions?
DV: exchange between neighbors only LS:
• convergence time varies, smaller • node can advertise incorrect
distance tables link cost
Speed of Convergence • each node computes only its
LS: O(n^2) algorithm requires O(nE) own table
messages DV:
• may have oscillations • DV node can advertise
DV: convergence time varies incorrect path cost
• may have routing loops
• each node’s table used by
• count-to-infinity problem others
link state routing converges more  error propagate thru
quickly than distance vector
• a router cannot pass routing network
information on until it has computed
its distance vector
• looping

31
Link Costs
Whether link costs are fixed or they vary with the
utilization of the link?
Proponents of variable costs:
• traffic is routed more optimally
• having costs assigned by network management requires
additional configuration
Proponents of fixed link costs:
• routing info needs to be generated only if the link goes down
or recovers
• if link costs change frequently, the network is often in an
unconverged state, not making good routing decisions
• stability
There are recent studies that find link costs in the
networks so as to maximize the total traffic through
the network (traffic matrix should be known)

32
Load Splitting
If costs are equal then traffic can be split amongst
equal-cost paths; splitting otherwise may lead to
routing loops
Applicable to both LS and DV
However, this annoys the transport layer
• Out of order packets
• Transport layer requires a uniform service for RTT and MTU
calculations
Flow-level splitting
• Packets of the same flow would follow the same path
• The router, if it has two equal cost paths, can do a hash of
(source IP, dest. IP, source port, dest. port) to select which
path the packet should take

33
Hierarchical Routing

Our routing study thus far - idealization


all routers identical
network “flat”
… not true in practice

scale: with 200 million


destinations: administrative autonomy
internet = network of networks
can’t store all dest’s in
each network admin may want to
routing tables!
control routing in its own
routing table exchange would network
swamp links!

34
Hierarchical Routing
Gateway router
Direct link to router in
aggregate routers into
another AS
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

35
Interconnected ASes

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1 Forwarding table is
configured by both intra-
and inter-AS routing
Intra-AS Inter-AS
algorithm
Routing
algorithm
Routing • Intra-AS sets entries for
algorithm
internal dests
Forwarding • Inter-AS & Intra-As sets
table entries for external dests

36
Inter-AS tasks AS1 needs:
Suppose router in AS1 1. to learn which dests are
receives datagram for reachable through AS2
which dest is outside of and which through AS3
AS1 2. to propagate this
• Router should forward reachability info to all
packet towards on of the routers in AS1
gateway routers, but Job of inter-AS routing!
which one?

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1

37
Example: Setting forwarding table in router 1d

Suppose AS1 learns from the inter-AS protocol that


subnet x is reachable from AS3 (gateway 1c) but not
from 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.
Puts in forwarding table entry (x,I).

38
Example: Choosing among multiple ASes

Now suppose AS1 learns from the 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 the job on inter-AS routing protocol!
Hot potato routing: send packet towards closest of two
routers.

Use routing info Determine from


Learn from inter-AS Hot potato routing: forwarding table the
from intra-AS
protocol that subnet Choose the interface I that leads
protocol to
x is reachable via gateway to least-cost gateway.
determine
multiple gateways that has the Enter (x,I) in
costs of least-cost
smallest least cost forwarding table
paths to each
of the gateways

39
Intra-AS Routing
Also known as Interior Gateway Protocols (IGP)
Most common Intra-AS routing protocols:

• RIP: Routing Information Protocol

• OSPF: Open Shortest Path First

• IGRP: Interior Gateway Routing Protocol (Cisco proprietary)

40

You might also like