network layer (contd.) routing
DESCRIPTION
Network Layer (contd.) Routing. network link physical. link physical. M. M. M. H t. M. H n. H n. H n. H n. H t. H t. H t. H t. M. M. M. M. H n. H t. H t. H l. H l. H l. H n. H n. H n. H t. H t. H t. M. M. M. Packet transfer in network. source. message. - PowerPoint PPT PresentationTRANSCRIPT
Network Layer (contd.)
Routing
source
application
transportnetwork
linkphysical
HtHn M
segment Ht
datagram
destination
application
transportnetwork
linkphysical
HtHnHl M
HtHn M
Ht M
M
networklink
physical
linkphysical
HtHnHl M
HtHn M
HtHn M
HtHnHl M
router
switch
Packet transfer in network
message M
Ht M
Hn
frame
Encapsulation
message
Network Layer 4-3
Network-Layer Functions
Forwarding: move packets from router’s input to router output
Image courtesy: http://www.nd.edu/~networks/Image%20Gallery/gallery_old.htm
Routing
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Send data 2. Receive data??
??
??
Image courtesy: http://www.nd.edu/~networks/Image%20Gallery/gallery_old.htm
Goal: determine “good” paths(sequences of routers)
through network from source to dest.
Routing
Graph: G = (N,E)
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) }
Routing: Graph formulation
Graph abstraction for the routing problem:
graph nodes are routers graph edges are physical
links links have properties: delay,
capacity, $ cost, policy u
yx
wv
z2
2
13
1
1
2
53
5
Network Layer 4-6
Graph abstraction: costs
u
yx
wv
z2
2
13
1
1
2
53
5 • c(x,x’) = cost of link (x,x’)
- e.g., c(w,z) = 5
• cost could always be 1, or inversely related to bandwidth,or inversely related to congestion
Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
7
Key Desired Properties of a Routing Algorithm
Simplicity
Robustness
Optimalityfind good path
(for user/provider)
8
Routing Design Space
Routing has a large design space who decides routing?
• source routing: end hosts make decision• network routing: networks make decision
how many paths from source s to destination d?
• multi-path routing • single path routing
will routing adapt to network traffic demand?• adaptive routing• static routing
…
- Robustness- Optimality- Simplicity
9
Routing has a large design space who decides routing?
• source routing: end hosts make decisionnetwork routing: networks/routers make decision
- Based on information available from the network how many paths from source s to destination
d?• multi-path routing • single path routing
will routing adapt to network traffic demand?• adaptive routing• static routing
…
- Robustness- Optimality- Simplicity
Routing Design Space: examplenetwork routing
Network Layer 4-10
Routing Algorithm design based on available information
Global or decentralized information?
Global: all routers have complete topology, link cost
info “link state” algorithms
Decentralized: router knows physically-connected
neighbors, link costs to neighbors iterative process of computation, exchange
of info with neighbors “distance vector” algorithms
u
yx
wv
z2
21
3
1
12
53
5
Network Layer 4-11
Link state (LS) routing algorithm
Network Layer 4-12
Link-State Routing Algorithm
Network topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info
Problem
Given a topology, link costs, and a source-destination (S-D) pair, determine a route from S to D so that the route has the minimum cost (i.e., is the shortest).
Solution: Dijkstra’s shortest-path algorithm
u
yx
wv
z2
21
3
1
12
53
5
Network Layer 4-13
A Link-State Routing Algorithm: Dijkstra’s Algorithm
Parameters: c(x,y): link cost from node x to y; = ∞ if not direct
neighbors D(v): current value of cost of path from source to
dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively
known
Network Layer 4-14
Dijkstra’s algorithm: example
u
yx
wv
z2
2
13
1
1
2
53
5
Step012345
N'u
uxuxy
uxyvuxyvw
uxyvwz
D(v),p(v)2,u2,u2,u
D(w),p(w)5,u4,x3,y3,y
D(x),p(x)1,u
D(y),p(y)∞
2,x
D(z),p(z)∞ ∞
4,y4,y4,y
Shortest paths:u x: 1,uu v: 2,uu y: 2,xu w: 3,yu z: 4,y
Network Layer 4-15
Dijkstra’s algorithm: example (2)
u
yx
wv
z
Resulting shortest-path tree from u:
vx
y
w
z
(u,v)(u,x)
(u,x)
(u,x)
(u,x)
destination link
Resulting forwarding table in u:
Shortest paths:u x: 1,uu v: 2,uu y: 2,xu w: 3,yu z: 4,y
Network Layer 4-16
Dijkstra’s Algorithm
1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 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'
Network Layer 4-17
Let’s solve this example!
Determine shortest paths from R1 to all other nodes with corresponding predecessor nodes!
Network Layer 4-18
Distance Vector routing algorithm
Distance Vector Routing
Practically entire network topology (each link state) may not be known accurately Only the information to a direct neighbor may be known
Distance-vector routing algorithm operates by Each router trusting its direct neighbors Each router maintain a table (vector) estimating
• the best known distance to each destination• which line to use to get there
Tables (vectors) are updated by exchanging information with the direct neighbors
At node i, the basic update rule
where - di denotes the distance
estimation from i to the destination,
- N(i) is set of neighbors of node i, and
- dij is the distance of the direct link from i to j
- dj denotes the distance estimation feedback from j to i
Based on Bellman-Ford algorithm
Distance Vector Routing: Basic Idea
)(min )( jijiNji ddd
i
jid
jdijd
destination
Network Layer 4-21
Distance Vector Algorithm
wait for (change in local link cost or msg from neighbor)
recompute estimates
if DV to any dest has
changed, notify neighbors
Each node:
neighbors then notify their neighbors and so on…
Iterative & Distributed
Network Layer 4-22
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost tofr
om
from
x y z
xyz
∞ ∞
∞ ∞ ∞
cost to
x y z
xyz
∞ ∞ ∞7 1 0
cost to
2 0 1
∞ ∞ ∞
time
x z12
7
y
node x table
node y table
node z table
∞
Initially:
D-V Algorithm example
Network Layer 4-23
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y z
xyz
0
from
cost to
x y z
xyz
∞ ∞
∞ ∞ ∞
cost to
x y z
xyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
time
x z12
7
y
node x table
node y table
node z table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3
32
Network Layer 4-24
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y z
xyz
0 2 3
from
cost to
x y z
xyz
∞ ∞
∞ ∞ ∞
cost tox y z
xyz
0 2 7
from
cost to
x y z
xyz
0 2 7
from
cost to
x y z
xyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
2 0 17 1 0
2 0 13 1 0
time
x z12
7
y
node x table
node y table
node z table
Network Layer 4-25
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y z
xyz
0 2 3
from
cost tox y z
xyz
0 2 3
from
cost to
x y z
xyz
∞ ∞
∞ ∞ ∞
cost tox y z
xyz
0 2 7
from
cost to
x y z
xyz
0 2 3
from
cost to
x y z
xyz
0 2 3
from
cost tox y z
xyz
0 2 7
from
cost to
x y z
xyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
2 0 17 1 0
2 0 13 1 0
2 0 13 1 0
2 0 1
3 1 0
2 0 1
3 1 0
time
x z12
7
y
node x table
node y table
node z table
Network Layer 4-26
Distance Vector: link cost changes
Link cost changes: node detects local link cost
change updates routing info, recalculates
distance vector if DV changes, notify neighbors
“goodnews travelsfast”
x z14
50
y1
At time t0, y detects the link-cost change, updates its DV, and informs its neighbors.
At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z.
Distance-Vector Algorithms: Link cost changes Bad news propagate slowly
This is called the counting-to-infinity problem
Distances to A
A goes down or line between
A and B is down
Solution: Split Horizon Hack
Actual distance to a destination is not reported on the line on which packets to that destination are sent.
Instead these distances are reported as “infinity: Poisoned reverse”
Will this completely solve count-to-infinity problem?
B
D
A
C C tells D the truthabout its distance toA, but lies to B andsays the distance isinfinity.
A topology where split horizon fails
Suppose that D becomes unreachable from C.
A and B are reportinginfinite distances to C, butthey are reporting distancesof length 2 to each other.
A and B will count to infinity.
Network Layer 4-30
Comparison of LS and DV algorithms
Message complexity LS: with n nodes, E links,
O(nE) msgs sent DV: exchange between
neighbors only convergence time varies
Speed of Convergence LS: O(n2) algorithm requires
O(nE) msgs may have oscillations
DV: convergence time varies may be routing loops count-to-infinity problem
Robustness: what happens if router malfunctions?
LS: node can advertise
incorrect link cost each node computes only
its own table
DV: DV node can advertise
incorrect path cost each node’s table used by
others • error propagate through
network