Notes on Network Layer - Computer Networks | ECS 152B, Study notes of Computer Systems Networking and Telecommunications

Material Type: Notes; Class: Computer Networks; Subject: Engineering Computer Science; University: University of California - Davis; Term: Spring 2005;

Typology: Study notes

Pre 2010

Uploaded on 09/17/2009

koofers-user-086
koofers-user-086 🇺🇸

7 documents

1 / 50

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Demet Aksoy 1ECS 152B Computer Networks
Lecture 3: Network Layer
nPrev. summary
nIP: packet switched
nLink layer Transport
Network
Link
Application
nToday’s lecture
nNetwork Layer
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32

Partial preview of the text

Download Notes on Network Layer - Computer Networks | ECS 152B and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

Lecture 3: Network Layer

n Prev. summary

n IP: packet switched

n Link layer

Transport

Network

Link

Application

n Today’s lecture

n Network Layer

Network Layer Functions

n path determination: route taken by packets from source to dest. Routing algorithms

n forwarding: move packets from router’s input to appropriate router output

n call setup: some network architectures require router call setup along path before data flows (not Internet)

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

application transport network data link physical

application transport network data link physical

The Internet Network layer

routing table

Routing protocols •path selection •RIP, OSPF, BGP

IP protocol •addressing conventions •datagram format •packet handling conventions

ICMP protocol •error reporting •router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Network

layer

Routing

Graph abstraction for routing algorithms:

n graph nodes are routers

n graph edges are physical links n link cost: delay, $ cost, or congestion level

Goal: determine “good” path (sequence of routers) thru network from source to dest.

Routing protocol

A

D E

B C

F

2 2 1

3

1

1 2

5

3

5

n “good” path:

n typically means

minimum cost path

n other def’s possible

A Link-State Routing

Algorithm Dijkstra’s algorithm

n net topology, link costs known to all nodes n accomplished via “link state broadcast” n all nodes have same info

n computes least cost paths from one node (‘source”) to all other nodes n gives routing table for that node

n iterative: after k iterations, know least cost path to k dest.’s

Notation: n c(i,j): link cost from node i to j. cost infinite if not direct neighbors n D(v): current value of cost of path from source to dest. V n p(v): predecessor node along path from source to v, that is next v n N: set of nodes whose least cost path definitively known

Dijsktra’s Algorithm

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

Dijkstra’s algorithm: example

Step 0 1 2 3 4 5

start N A AD ADB ADBE ADBEC ADBECF

D(B),p(B) 2,A 2,A

D(C),p(C) 5,A 4,D 4,D 3,E

D(D),p(D) 1,A

D(E),p(E) infinity 2,D 2,D

D(F),p(F) infinity infinity infinity 4,E 4,E

A

D E

B C

F

2 2 1

3

1

1 2

5

3

5

Dijkstra’s algorithm: example

Step 0 1 2 3 4 5

start N A AD ADB ADBE ADBEC ADBECF

D(B),p(B) 2,A 2,A

D(C),p(C) 5,A 4,D 4,D 3,E

D(D),p(D) 1,A

D(E),p(E) infinity 2,D

D(F),p(F) infinity infinity infinity 4,E 4,E

A

D E

B C

F

2 2 1

3

1

1 2

5

3

5

Dijkstra’s algorithm: example

Step 0 1 2 3 4 5

start N A AD ADB ADBE ADBEC ADBECF

D(B),p(B) 2,A 2,A

D(C),p(C) 5,A 4,D 4,D 3,E

D(D),p(D) 1,A

D(E),p(E) infinity 2,D

D(F),p(F) infinity infinity infinity 4,E 4,E

A

D E

B C

F

2 2 1

3

1

1 2

5

3

5

Distance Vector Routing

Algorithm

distributed:

n each node communicates only with directly-attached

neighbors

iterative:

n continues until no nodes exchange info.

n self-terminating : no “signal” to stop

asynchronous:

n nodes need not exchange info/iterate in lock step!

Distance Vector Algorithm:

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

X X

X w

At all nodes, X:

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 (y,V) = D (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 DV(Y,w) / 20 / call this received new value is "newval" */ 21 for the single destination y: D (Y,V) = c(X,V) + newval 22 23 if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors 25 26 forever

w

X X

X X

X

w w

Distance Vector Algorithm:

example

Y Z

(^27)

1

X

Distance Vector Algorithm:

example

Y Z

(^27)

1

X

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

Z

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

Y