12
1 Week 5 Lecture 2 IP Layer

1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

Embed Size (px)

Citation preview

Page 1: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

1

Week 5 Lecture 2

IP Layer

Page 2: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

2

Network layer functions

transport packet from sending to transport packet from sending to receiving hosts receiving hosts

network layer protocols in network layer protocols in everyevery host, routerhost, router

important functions:important functions: path determinationpath determination:: route route

taken by packets from taken by packets from source to dest. source to dest. Routing Routing algorithmsalgorithms

forwardingforwarding:: move packets move packets from router’s input to from router’s input to appropriate router outputappropriate router output

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 3: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

3

Routing (Network) Layer location

application:application: supporting network supporting network applicationsapplications FTP, SMTP, STTPFTP, SMTP, STTP

transport:transport: host-host data transfer host-host data transfer TCP, UDPTCP, UDP

network:network: routing of datagrams from routing of datagrams from source to destinationsource to destination IP, routing protocolsIP, routing protocols

link:link: data transfer between neighboring data transfer between neighboring network elementsnetwork elements PPP, EthernetPPP, Ethernet

physical:physical: bits “on the wire” bits “on the wire”

application

transport

network

link

physical

Page 4: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

4

The Internet Network layer

forwardingtable

Host, router network layer functions:Host, router network layer functions:

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

Networklayer

Page 5: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

5

Using Routers in IP Layer

routers:routers: no state about end-to-end connections no state about end-to-end connections no network-level concept of “connection”no network-level concept of “connection”

packets forwarded using destination host addresspackets forwarded using destination host address packets between same source-dest pair may take packets between same source-dest pair may take

different pathsdifferent paths

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Send data 2. Receive data

Page 6: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

6

Routing

Graph abstraction for routing Graph abstraction for routing algorithms:algorithms:

graph nodes are routersgraph nodes are routers graph edges are physical graph edges are physical

linkslinks link cost: delay, $ cost, link cost: delay, $ cost,

or congestion levelor congestion level

Goal: determine “good” path

(sequence of routers) thru network from source to

dest.

Routing protocol

A

ED

CB

F

2

2

13

1

1

2

53

5

““good” path:good” path: typically means typically means

minimum cost pathminimum cost path other def’s possibleother def’s possible

Page 7: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

7

Routing Algorithm classificationGlobal or decentralized information?Global or decentralized information?

1. 1. Global:Global: all routers have all routers have completecomplete topology, topology,

link cost infolink cost info ““link state” algorithmslink state” algorithms

2. Decentralized:2. Decentralized: router ONLY knows physically-router ONLY knows physically-

connected neighbors, link costs to connected neighbors, link costs to neighborsneighbors

iterative process of computation, iterative process of computation, exchange of info with neighborsexchange of info with neighbors

““distance vector” algorithmsdistance vector” algorithms

Static or dynamic?Static or dynamic?Static: Static: routes change slowly over routes change slowly over

timetime

Dynamic: Dynamic: routes change more routes change more

quicklyquickly periodic updateperiodic update in response to link in response to link

cost changescost changes

Page 8: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

8

A Link-State Routing AlgorithmDijkstra’s algorithmDijkstra’s algorithm net topology, link costs net topology, link costs

known to all nodesknown to all nodes accomplished via “link accomplished via “link

state broadcast” state broadcast” all nodes have same all nodes have same

infoinfo computes least cost paths from one computes least cost paths from one

node (‘source”) to all other nodesnode (‘source”) to all other nodes gives gives routing tablerouting table for that node for that node

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

Notation:Notation: c(i,j):c(i,j): link cost from node i link cost from node i

to j. cost infinite if not direct to j. cost infinite if not direct neighborsneighbors

D(v):D(v): current value of current value of total total costcost of path from source to of path from source to dest. Vdest. V

p(v):p(v): predecessor nodepredecessor node along path from source to v, along path from source to v, that is next vthat is next v

N:N: set of nodes whose set of nodes whose least least cost path already knowncost path already known

Page 9: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

9

Dijsktra’s Algorithm (A others)

1 Initialization: 2 N = {A} ---- Our goal3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infinity 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

Page 10: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

10

Dijkstra’s algorithm: example (source: A)

Step012345

start NA

ADADE

ADEBADEBC

ADEBCF

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

D(C),p(C)5,A4,D3,E3,E

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

D(E),p(E)infinity

2,D

D(F),p(F)infinityinfinity

4,E4,E4,E

A

ED

CB

F

2

2

13

1

1

2

53

5

Page 11: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

11

Dijkstra’s algorithm, discussion

Algorithm complexity: Algorithm complexity: n nodesn nodes each iteration: need to check all nodes, w, not in Neach iteration: need to check all nodes, w, not in N n*(n+1)/2 comparisons: O(n**2)n*(n+1)/2 comparisons: O(n**2) more efficient implementations possible: O(nlogn)more efficient implementations possible: O(nlogn)

Oscillations possible:Oscillations possible: e.g., link cost = amount of carried traffice.g., link cost = amount of carried traffic

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 12: 1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts

12

Any questions?