TCP/IP Network Layer (1)

19
ICT 6621 : Advanced Networking TCP/IP Network Layer (1)

description

TCP/IP Network Layer (1). 5. 3. v. w. 2. 5. u. 2. 1. z. 3. 1. 2. x. y. 1. Routing. Routing protocol Goal: determine “good” path (sequence of routers) through network from source to destination. Graph abstraction for routing algorithms: graph nodes are routers - PowerPoint PPT Presentation

Transcript of TCP/IP Network Layer (1)

Page 1: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

TCP/IP Network Layer (1)

Page 2: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Routing• Routing protocol

– Goal: determine “good” path (sequence of routers) through network from source to destination.

• Graph abstraction for routing algorithms:– graph nodes are routers

e.g. N={u,v,w,x,y,z}– graph edges are physical links

e.g. E={(u,v), (u,x)…..(y,z)}– link cost: delay, $ cost, or congestion

level– 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)

• “good” path:– typically means minimum cost

path– other definitions possible

u

v

x y

z

w

5

23

12 3

12

51

Page 3: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Routing Algorithm Classification

Global or decentralized information?

Global:• all routers have complete topology,

link cost information• “link state” algorithmsDecentralized: • router knows physically-connected

neighbors, link costs to neighbors• iterative process of computation,

exchange of information with neighbors

• “distance vector” algorithms

Static or dynamic?

Static: • routes change slowly

over time

Dynamic: • routes change more

quickly– periodic update– in response to link

cost changes

Page 4: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

A Link-State Routing Algorithm

Dijkstra’s algorithm• net topology, link costs known

to all nodes– accomplished via “link state

broadcast” – all nodes have same

information• computes least cost paths from

one node (‘source”) to all other nodes– gives forwarding table for

that node• iterative: after k iterations, know

least cost path to k destinations

Notation:• c(x,y): link cost from node

x to y; = ∞ if not direct neighbors

• D(v): current value of least cost of path from source to node v

• p(v): immediate predecessor node along path from source to v

• N: set of nodes whose least cost path definitively known

Page 5: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Dijsktra’s AlgorithmInitialization: 2 N = {i} 3 for all nodes j4 if j adjacent to i 5 then D(j) = c(i,j) 6 else D(j) = ∞ 7 8 Loop 9 find k not in N such that D(k) is a minimum 10 add k to N 11 update D(j) for all j adjacent to k and not in N : 12 D(j) = min( D(j), D(k) + c(k,j) ) 13 /* new cost to j is either old cost to j or known 14 shortest path cost to k plus cost from k to j */ 15 until all nodes in N

Page 6: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Dijsktra’s Algorithm (Example)Step N D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)

u

v

x y

z

w

5

23

12 3

12

51

0 u 2,u 5,u 1,u ∞ ∞

1 ux 2,u 4,x 2,x ∞

2 uxy 2,u 3,y 4,y

3 uxyv 3,y 4,y

4 uxyvw 4,y

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

Page 7: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Link-State Routing - DiscussionAlgorithm complexity: n nodes• each iteration: need to check all nodes, k, not in N• n + (n-1) + … + 1 = n(n+1)/2 comparisons, i.e. O(n2)• more efficient implementations possible: O(nlogn)

Weakness of Link State Routing

• Oscillations may arise, e.g., consider link cost = amount of carried traffic

• Remedy: don’t allow all the routers to run LSR at the same time

A

D

C

B1 1+e

e0

e

1 1

0 0

A

D

C

B2+e 0

001+e1

A

D

C

B0 2+e

1+e10 0

A

D

C

B2+e 0

e01+e1

initially… recompute

routing… recompute … recompute

Page 8: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Routing Algorithm• distributed:

– each node communicates only with directly-attached neighbors• iterative:

– continues until no nodes exchange information.– self-terminating: no “signal” to stop

• asynchronous:– nodes need not exchange information/iterate in lock step!

• Distance Table data structures– each node has its own distance table (leads to routing table)– row for each possible destination– column for each directly-attached neighbor to node– consider node X, for destination. Y via neighbor Z, distance table

entry is given by the equation:

= distance from X to Y, via Z as next hop

=

Page 9: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Table Example

Page 10: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Table Gives Routing Table

Page 11: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Routing Algorithm

Iterative, asynchronous: each local iteration caused by:

• local link cost change • DV update message from

neighbor

Distributed:• each node notifies

neighbors only when its DV changes– neighbors then notify their

neighbors if necessary

wait for (change in local link cost of msg from neighbor)

recompute estimates

if DV to any dest has

changed, notify neighbors

Each node:

Page 12: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Routing Algorithm

Page 13: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Algorithm: Example

1 Initialization:2 for all adjacent nodes v:3 DX(*,v) = infty /* the * operator means "for all rows" */4 DX(v,v) = c(X,v)5 for all destinations, y6 send minwD(y,w) to each neighbor /* w over all X's neighbors */78 loop9 wait (until I see a link cost change to neighbor V10 or until I receive update from neighbor V)1112 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: DX(y,V) = DX(y,V) + d1617 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 minw DV(Y,w) */20 /* call this received new value is "newval" */21 for the single destination y: DX(Y,V) = c(X,V) + newval2223 if we have a new minw DX(Y,w)for any destination Y24 send new value of minw DX(Y,w) to all neighbors2526 forever

Page 14: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Algorithm: Example

Page 15: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Algorithm: Example

Page 16: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector Algorithm: Example

Page 17: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector : link cost changes

x z14

50

y1• node detects local link cost change

• updates routing info, recalculates distance vector• if cost change in least cost path, notify neighbors

• 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.

Page 18: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector : link cost changes

• good news travels fast• bad news travels slow - “count to infinity” problem!

x z14

50

y60

Page 19: TCP/IP Network Layer (1)

ICT 6621 : Advanced Networking

Distance Vector : Poisoned Reverse

If Z routes through Y to get to X :• Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z)

x z14

50

y60