application transport network data link physical Chapter 4

































- Slides: 33

application transport network data link physical Chapter 4 – The Network Layer & Routing network data link physical network data link physical application transport network data link physical The network layer moves transport layer segments from host to host in the network, to deliver them to their destination. This layer involves each and every host and router in the network. We will study the key principles and algorithms of routing, with a focus on the Internet Protocol (IP) service model. 4: Network Layer 1

Chapter 4: Network Layer Chapter goals: Overview: r understand principles r network layer services behind network layer services: m m routing (path selection) dealing with scale how a router works … switching advanced topics: IPv 6, multicast intro r instantiation and implementation in the Internet r routing principle: path selection r hierarchical routing r IP r Internet routing protocols m m intra-domain inter-domain r what’s inside a router? r IPv 6 r multicast routing 4: Network Layer 2

Network layer functions r transport packet from sending to receiving hosts r network layer protocols in every host, router three important functions: r path determination: route taken by packets from source to destination - routing algorithms r switching: move packets from router’s input to appropriate router output r call setup: some network architectures require router call setup along path before data flows (what types? ) application transport network data link physical network data link physical network data link physical application transport network data link physical 4: Network Layer 3

Network service model service abstraction Q: What is the appropriate service model for transporting packets from sender to receiver? r guaranteed bandwidth? r preservation of inter-packet timing (no jitter)? r loss-free delivery? r in-order delivery? r congestion feedback to sender? The most important service abstraction to consider, as provided by the network layer: ? ? ? virtual circuit network or datagram network? Recall: don’t confuse the term “datagram” as used here with the Java UDP segment name discussed earlier. 4: Network Layer 4

Virtual circuits the source-to-destination path behaves much like a telephone circuit m m performance-wise network actions along source-to-destination path r call setup, teardown for each call before data can flow r each packet carries VC identifier (not destination host ID) r every router/switch on source-destination path maintains a “state” for each passing connection m Recall: transport-layer connection only involved two end systems r link and router resources (bandwidth, buffers) may be dedicated to the VC m m to get circuit-like performance but… what about start-up delay? 4: Network Layer 5

Virtual circuits: signaling protocols r used to setup, maintain and teardown the VC r used in ATM, frame-relay and X. 25 r not used in the Internet (why? ) application transport 5. Data flow begins network 4. Call connected data link 1. Initiate call physical 6. Receive data application 3. Accept call transport 2. incoming call network data link physical 4: Network Layer 6

Datagram networks: the Internet model r no call setup at network layer r routers: do not maintain state for the end-to-end connections m no network-level concept of a “connection” r packets are typically routed using only destination host ID which is carried in the packet m packets between same source-destination pair may take different paths application transport network data link 1. Send data physical application transport 2. Receive data network data link physical 4: Network Layer 7

Network layer service models: Network Architecture Internet Service Model Guarantees ? Congestion Bandwidth Loss Order Timing feedback best effort none ATM CBR ATM VBR ATM ABR ATM UBR constant rate guaranteed minimum none no no no yes yes yes no no (inferred via loss) no congestion yes no no r Note- the Internet model may be extended: Integrated Services (Intserv), Differentiated Services (Diffserv) m Chapter 6 4: Network Layer 8

Summary: Datagram or VC network… why? Internet r data exchange among ATM r evolved from telephony computers r human conversation: m “elastic” service, no strict m strict timing, reliability timing required (data delivery) requirements r “smart” end systems m need for guaranteed (computers) service m can adapt, perform r “dumb” end systems control, error recovery m telephones, “videophones” m complexity at “edge”, m complexity inside the simple in network core network r many link types m different characteristics Consider: IP over ATM m uniform service difficult (more later) 4: Network Layer 9

5 Routing protocol Goal: determine a “good” path (sequence of routers) thru the network from the source to the destination r “good” path: m typically means minimum cost path m other definitions also possible 2 A B 2 1 D 3 C 3 1 5 F 1 E 2 Graph abstraction for routing algorithms: r graph nodes are routers r graph edges are physical links m m link cost: delay, distance, # of hops, rate structure or congestion level = $$ Other costs? ? 4: Network Layer 10

Routing Algorithm classification Global or decentralized cost information? Global: r all routers have complete topology & link cost info r “link state” algorithms Decentralized: r router knows physicallyconnected neighbors, link costs to route to neighbors r iterative process of computation & exchange of info with neighbors r “distance vector” algorithms Static or dynamic? Static: r routes change slowly over time Dynamic: r routes change more quickly m periodic algorithmdriven updates m responsive to link cost changes 5 A 2 1 B 2 D 3 C 3 1 5 F 1 E 2 4: Network Layer 11

A Link-State Routing Algorithm Dijkstra’s algorithm r net topology, link costs known to all nodes m accomplished via “link state broadcast” m all nodes have same info r computes least cost paths from one node (“source”) to all other nodes m yields a routing table for that node r iterative: after k iterations, know least cost path to k destinations Notation: r c(i, j): link cost from node i to node j. Cost is initially infinite if not a direct neighbor r D(v): current computed value of cost of the path from the source to destination v r p(v): predecessor node, that is a neighbor of v, along the path from the source to v r N: set of nodes whose least cost path is definitively known 4: Network Layer 12

Dijsktra’s Algorithm 1 Initialization: 2 N = {A} // Source node is “A” 5 3 for all nodes v 3 4 if v adjacent to A B 2 5 then D(v) = c(A, v) A 2 3 6 else D(v) = infinity 1 D 7 1 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 C 5 F 1 E 2 4: Network Layer 13

Dijkstra’s algorithm: example Step 0 1 2 3 4 5 start N A AD ADEBCF D(B), p(B) D(C), p(C) D(D), p(D) D(E), p(E) D(F), p(F) 2, A 1, A 5, A infinity 2, A 4, D 2, D infinity 2, A 3, E 4, E 5 2 A B 2 1 D 3 C 3 1 5 F 1 E 2 4: Network Layer 14

Dijkstra’s algorithm, discussion Algorithm complexity: n nodes r each iteration: need to check all nodes, w, not in N r n*(n+1)/2 comparisons => worst case complexity O(n 2) r more efficient implementations possible: O(nlogn) Oscillations possible with congestion-based costing: r e. g. , link cost = amount of carried traffic (load) D 1 1 0 A 0 0 C e 1+e e initially B 1 2+e A 0 D 1+e 1 B 0 0 C … recompute routing 0 D 1 A 0 0 C 2+e B 1+e … recompute 2+e A 0 D 1+e 1 B e 0 C … recompute 4: Network Layer 15

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

Distance Table: example A E D (C, D) D (A, D) E C E cost to destination via D () A B D A 1 14 5 B 7 8 5 C 6 9 4 D 4 11 2 2 8 1 E B E 2 D D = c(E, D) + minw {D (C, w)} = 2+2 = 4 D = c(E, D) + minw {D (A, w)} = 2+3 = 5 loop back through E! destination 7 1 B D (A, B) = c(E, B) + minw{D (A, w)} = 8+6 = 14 loop back through E! 4: Network Layer 17

Distance table gives routing table E cost to destination via Outgoing link to use, cost B D E A 1 14 5 A A, 1 B 7 8 5 B D, 5 C 6 9 4 C D, 4 D 4 11 2 D D, 2 Distance table destination A destination D () Routing table >> next link, cost 4: Network Layer 18

Distance Vector Routing: overview Iterative, asynchronous: each local iteration caused by: r local link cost change r message from neighbor: its least cost path changed from a neighbor Distributed: r each node notifies neighbors only when its least cost path to any destination changes m neighbors then notify their neighbors if necessary Each node: wait for (change in local link cost, or notification from a neighbor) recompute distance table if least cost path to any dest. has changed, notify neighbors 4: Network Layer 19

Distance Vector Algorithm (Bellman-Ford): At all nodes, X: 1 Initialization: 2 for all adjacent nodes v: 3 DX(*, v) = infinity /* 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 4: Network Layer 20

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

Distance Vector Algorithm: example X 2 Y 7 1 Z E. G. , at node X: Information from Y that its cost to Z is 1… add to X cost to Z via Y Information from Z that its cost to Y is 1… add to X cost to Y via Z 4: Network Layer 22

Distance Vector Algorithm: example X 2 Y 7 1 Z Z X D (Y, Z) = c(X, Z) + minw{D (Y, w)} = 7+1 = 8 Y X D (Z, Y) = c(X, Y) + minw {D (Z, w)} = 2+1 = 3 4: Network Layer 23

Distance Vector Algorithm: example 7 A 1 B C 2 8 1 E 2 D DA B E DB A C B A 7 C C D D E 1 DD C A A A B B D E 1 8 & update DC B D B 7 E Initialize… E 1 2 C E E DE A B D 1 8 C 2 2 D 2 4: Network Layer 24

Distance Vector Algorithm: example 7 A 1 B C 2 8 1 E 2 D DA B E DB A C B A 7 C C D D E E DE A B D A A A B B D E 2 C E 1 E DD C 1 7 1 DC B D B E 8 1 8 C 2 2 D 2 4: Network Layer 25

Distance Vector Algorithm: example 7 A 1 B C 2 8 1 E 2 D DA B E DB A C E B A 9 7 9 C C 3 D 10 E 1 E 8 E DE A B D DD C A A 3 A B 10 B D E 1 2 1 D DC B D B 7 C E 1 8 C 2 2 D 2 4: Network Layer 26

Distance Vector Algorithm: example 7 A 1 B C 2 8 1 E 2 D DA B E DB A C E B A 9 7 9 C C 3 D 10 E 1 E 8 E DE A B D DD C A A 3 A B 10 B D E 1 2 1 D DC B D B 7 C E 1 8 C 2 2 D 2 4: Network Layer 27

Distance Vector Algorithm: example 7 A DA B E DB A C E B 7 A 9 C 8 D 17 3 D 10 E 15 1 E 8 DC B D DD C E DE A B D A 8 A 3 A B 10 B 8 D 11 C 9 E 9 D 18 1 B C 2 8 1 E 2 D 2 C E 9 7 C 2 2 1 1 15 2 4: Network Layer 28

Distance Vector Algorithm: example 7 A DA B E DB A C E B 7 A 9 C 8 D 17 3 D 10 E 15 1 E 8 DC B D DD C E DE A B D A 8 A 3 A B 10 B 8 D 11 C 9 E 9 D 18 1 B C 2 8 1 E 2 D 2 C E 9 7 C 2 2 1 1 and so on… 15 2 4: Network Layer 29

Distance Vector: link cost changes Link cost changes: r node detects local link cost change r updates distance table (line 15) r if cost change in least cost path, notify neighbors (lines 23, 24) “good news travels fast” 1 X 4 Y 50 1 Z algorithm terminates 4: Network Layer 30

Distance Vector: link cost changes Link cost changes: 60 r good news travels fast r bad news travels slowly - X “count to infinity” problem! Y Y Y 4 Y 50 1 Z algorithm continues on! 4: Network Layer 31

Distance Vector: poisoned reverse If Z routes through Y to get to X : r Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) r will this completely solve count to infinity problem? Y Y 60 X Y Y 4 50 1 Z Y algorithm terminates 4: Network Layer 32

Comparison of LS and DV algorithms Message complexity r LS: with n nodes, E links, O(n. E) msgs sent/broadcast r DV: exchange between neighbors only m convergence time varies Speed of Convergence r LS: O(n 2) algorithm requires O(n. E) msgs m may have oscillations r DV: convergence time varies m may be routing loops m count-to-infinity problem • poisoned reverse is sometimes successful Robustness: what happens if router malfunctions? LS: m m node can advertise incorrect link cost each node computes only its own table DV: m m DV node can advertise incorrect path cost each node’s table used by others • errors propagate through the network 4: Network Layer 33