hapter 4: Network Layer hapter goals: understand principles behind layer services: routing (path selection) dealing with scale how a router works advanced topics: IPv6, multicast instantiation and implementation in the Internet Overview: layer services routing principle: path selection hierarchical routing IP Internet routing protocols reliable transfer intra-domain inter-domain what s inside a router? IPv6 multicast routing 4: Network Layer 4a- Network layer functions transport packet from sending to receiving hosts layer protocols in every host, router application transport three important functions: path determination: route taken by packets from source to dest. Routing algorithms switching: move packets from router s input to appropriate router output call setup: some architectures require router call setup along path before data flows application transport 4: Network Layer 4a-
Network service model service abstraction Q: What service model for channel transporting packets from sender to receiver? guaranteed bandwidth? preservation of inter-packet timing (no jitter)? loss-free delivery? in-order delivery? congestion feedback to sender? The most important abstraction provided by layer:??? virtual circuit or datagram? 4: Network Layer 4a-3 Virtual circuits source-to-dest path behaves much like telephone circuit performance-wise actions along source-to-dest path call setup, teardown for each call before data can flow each packet carries V identifier (not destination host OD) every router on source-dest path s maintain state for each passing connection transport-layer connection only involved two end systems link, router resources (bandwidth, buffers) may be allocated to V to get circuit-like perf. 4: Network Layer 4a-4
Virtual circuits: signaling protocols used to setup, maintain teardown V used in TM, frame-relay,.5 not used in today s Internet application transport 5. Data flow begins 6. Receive data 4. all connected 3. ccept call. Initiate call. incoming call application transport 4: Network Layer 4a-5 Datagram s: the Internet model no call setup at layer routers: no state about end-to-end connections no -level concept of connection packets typically routed using destination host ID packets between same source-dest pair may take different paths application transport. Send data. Receive data application transport 4: Network Layer 4a-6
Network layer service models: Network rchitecture Service Model andwidth Guarantees? Loss Order Timing ongestion feedback Internet TM TM TM TM best effort R VR R UR none constant rate guaranteed rate guaranteed minimum none no yes yes no no no yes yes yes yes no yes yes no no no (inferred via loss) no congestion no congestion yes no Internet model being extented: Intserv, Diffserv hapter 6 4: Network Layer 4a-7 Datagram or V : why? Internet data exchange among computers elastic service, no strict timing req. smart end systems (computers) can adapt, perform control, error recovery simple inside, complexity at edge many link types different characteristics uniform service difficult TM evolved from telephony human conversation: strict timing, reliability requirements need for guaranteed service dumb end systems telephones complexity inside 4: Network Layer 4a-8
Routing Routing protocol Goal: determine good path (sequence of routers) thru from source to dest. Graph abstraction for routing algorithms: graph nodes are routers graph edges are links link cost: delay, $ cost, or congestion level 5 D 3 3 good path: E 5 F typically means minimum cost path other def s possible 4: Network Layer 4a-9 Routing lgorithm classification Global or decentralized information? Global: all routers have complete topology, link cost info link state algorithms Decentralized: router knows lyconnected neighbors, link costs to neighbors iterative process of computation, exchange of info 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 4: Network Layer 4a-0
Link-State Routing lgorithm Dijkstra s algorithm net topology, link costs known to all nodes accomplished via link state broadcast all nodes have same info computes least cost paths from one node ( source ) to all other nodes gives routing table for that node iterative: after k iterations, know least cost path to k dest. s Notation: c(i,j): link cost from node i to j. cost infinite 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, that is next v N: set of nodes whose least cost path definitively known 4: Network Layer 4a- Dijsktra s lgorithm Initialization: N = {} 3 for all nodes v 4 if v adjacent to 5 then D(v) = c(,v) 6 else D(v) = infty 7 8 Loop 9 find w not in N such that D(w) is a minimum 0 add w to N update D(v) for all v adjacent to w and not in N: D(v) = min( D(v), D(w) + c(w,v) ) 3 /* new cost to v is either old cost to v or known 4 shortest path cost to w plus cost from w to v */ 5 until all nodes in N 4: Network Layer 4a-
Dijkstra s algorithm: example Step 0 3 4 5 start N D DE DE DE DEF D(),p(),,, D(),p() 5, 4,D 3,E 3,E D(D),p(D), D(E),p(E) infinity,d D(F),p(F) infinity infinity 4,E 4,E 4,E 5 D 3 3 E 5 F 4: Network Layer 4a-3 Dijkstra s algorithm, discussion lgorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n*(n+)/ comparisons: O(n**) more efficient implementations possible: O(nlogn) Oscillations possible: e.g., link cost = amount of carried traffic +e D 0 0 0 e e initially +e 0 D 0 +e 0 recompute routing 0 +e D 0 0 +e recompute +e 0 D 0 +e e recompute 4: Network Layer 4a-4
Distance Vector Routing lgorithm iterative: continues until no nodes exchange info. self-terminating: no signal to stop asynchronous: nodes need not exchange info/iterate in lock step! distributed: each node communicates only with directly-attached neighbors Distance Table data structure each node has its own row for each possible destination column for each directlyattached neighbor to node example: in node, for dest. Y via neighbor Z: D (Y,Z) = = distance from to Y, via Z as next hop Z c(,z) + min {D (Y,w)} w 4: Network Layer 4a-5 Distance Table: example 7 E D (,D) E D (,D) E D (,) E 8 D D = c(e,d) + min {D (,w)} w = + = 4 D = c(e,d) + min {D (,w)} w = +3 = 5 loop! = c(e,) + min {D (,w)} w = 8+6 = 4 loop! destination E D () D cost to destination via 7 6 4 4 8 9 D 5 5 4 4: Network Layer 4a-6
Distance table gives routing table E D () cost to destination via D Outgoing link to use, cost 4 5, destination 7 6 8 9 5 4 destination D,5 D,4 D 4 D D,4 Distance table Routing table 4: Network Layer 4a-7 Distance Vector Routing: overview Iterative, asynchronous: each local iteration caused by: local link cost change message from neighbor: its least cost path change from neighbor Distributed: each node notifies neighbors only when its least cost path to any destination changes neighbors then notify their neighbors if necessary Each node: wait for (change in local link cost of msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors 4: Network Layer 4a-8
Distance Vector lgorithm: t all nodes, : Initialization: for all adjacent nodes v: 3 D (*,v) = infty /* the * operator means "for all rows" */ 4 D (v,v) = c(,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all 's neighbors */ w 4: Network Layer 4a-9 Distance Vector lgorithm (cont.): 8 loop 9 wait (until I see a link cost change to neighbor V 0 or until I receive update from neighbor V) if (c(,v) changes by d) 3 /* change cost to all dest's via neighbor v by d */ 4 /* note: d could be positive or negative */ 5 for all destinations y: D (y,v) = D (y,v) + d 6 7 else if (update received from V wrt destination Y) 8 /* shortest path from V to some Y has changed */ 9 /* V has sent a new value for its min wdv(y,w) */ 0 /* call this received new value is "newval" */ for the single destination y: D (Y,V) = c(,v) + newval 3 if we have a new min w D (Y,w)for any destination Y 4 send new value of min D (Y,w) to all neighbors w 5 6 forever 4: Network Layer 4a-0
Distance Vector lgorithm: example Y 7 Z 4: Network Layer 4a- Distance Vector lgorithm: example Y 7 Z Z D (Y,Z) = c(,z) + min {D (Y,w)} w = 7+ = 8 Y D (Z,Y) = c(,y) + min {D (Z,w)} w = + = 3 4: Network Layer 4a-
Distance Vector: link cost changes Link cost changes: node detects local link cost change updates distance table (line 5) if cost change in least cost path, notify neighbors (lines 3,4) 4 Y 50 Z good news travels fast algorithm terminates 4: Network Layer 4a-3 Distance Vector: link cost changes Link cost changes: good news travels fast bad news travels slow - count to infinity problem! 60 4 Y 50 Z algorithm continues on! 4: Network Layer 4a-4
Distance Vector: poisoned reverse If Z routes through Y to get to : Z tells Y its (Z s) distance to is infinite (so Y won t route to via Z) will this completely solve count to infinity problem? 60 4 Y 50 Z algorithm terminates 4: Network Layer 4a-5 omparison of LS and DV algorithms Message complexity LS: with n nodes, E links, O(nE) msgs sent each DV: exchange between neighbors only convergence time varies Speed of onvergence LS: O(n**) 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 thru 4: Network Layer 4a-6
Hierarchical Routing Our routing study thus far - idealization all routers identical flat nottrue in practice scale: with 50 million destinations: can t store all dest s in routing tables! routing table exchange would swamp links! administrative autonomy internet = of s each admin may want to control routing in its own 4: Network Layer 4a-7 Hierarchical Routing aggregate routers into regions, autonomous systems (S) routers in same S run same routing protocol intra-s routing protocol routers in different S can run different intra- S routing protocol gateway routers special routers in S run intra-s routing protocol with all other routers in S also responsible for routing to destinations outside S run inter-s routing protocol with other gateway routers 4: Network Layer 4a-8
Intra-S and Inter-S routing a.b b d.a a b.c c.a a c Gateways: perform inter-s routing amongst themselves b perform intra-s routers with other routers in their S inter-s, intra-s routing in gateway.c layer link layer layer 4: Network Layer 4a-9 Intra-S and Inter-S routing a Host h.b b.a Inter-S routing between and.c a d b c Intra-S routing within S.a Host c h a b Intra-S routing within S We ll examine specific inter-s and intra-s Internet routing protocols shortly 4: Network Layer 4a-30
The Internet Network layer Host, router layer functions: Transport layer: TP, UDP Network layer Routing protocols path selection RIP, OSPF, GP routing table IP protocol addressing conventions datagram format packet handling conventions IMP protocol error reporting router signaling Link layer layer 4: Network Layer 4a-3 IP ddressing: introduction IP address: 3-bit identifier for host, router interface interface: connection between host, router and link router s typically have multiple interfaces host may have multiple interfaces IP addresses associated with interface, not host, router 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3... 3..3. 3... = 0 0000000 0000000 0000000 3 4: Network Layer 4a-3
IP ddressing IP address: part (high order bits) host part (low order bits) What s a? (from IP address perspective) device interfaces with same part of IP address can ly reach each other without intervening router 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 LN 3... 3..3. consisting of 3 IP s (for IP addresses starting with 3, first 4 bits are address) 4: Network Layer 4a-33 IP ddressing How to find the s? Detach each interface from router, host create islands of isolated s 3... 3... 3...4 3...3 3..9. 3..7.0 3..9. 3..7. 3..8. 3..8.0 3...6 3..3.7 Interconnected system consisting of six s 3... 3... 3..3. 3..3. 4: Network Layer 4a-34
IP ddresses given notion of, let s re-examine IP addresses: class-full addressing: class 0 host 0 host 0 host D 0 multicast address.0.0.0 to 7.55.55.55 8.0.0.0 to 9.55.55.55 9.0.0.0 to 3.55.55.55 4.0.0.0 to 39.55.55.55 3 bits 4: Network Layer 4a-35 IP addressing: IDR classful addressing: inefficient use of address space, address space exhaustion e.g., class net allocated enough addresses for 65K hosts, even if only K hosts in that IDR: lassless InterDomain Routing portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in portion of address part 00000 0000 0000000 00000000 00.3.6.0/3 host part 4: Network Layer 4a-36
IP addresses: how to get one? Hosts (host portion): hard-coded by system admin in a file DHP: Dynamic Host onfiguration Protocol: dynamically get address: plug-and-play host broadcasts DHP discover msg DHP server responds with DHP offer msg host requests IP address: DHP request msg DHP server sends address: DHP ack msg 4: Network Layer 4a-37 IP addresses: how to get one? Network ( portion): get allocated portion of ISP s address space: ISP's block 00000 0000 0000000 00000000 00.3.6.0/0 Organization 0 00000 0000 0000000 00000000 00.3.6.0/3 Organization 00000 0000 000000 00000000 00.3.8.0/3 Organization 00000 0000 000000 00000000 00.3.0.0/3....... Organization 7 00000 0000 0000 00000000 00.3.30.0/3 4: Network Layer 4a-38
Hierarchical addressing: route aggregation Hierarchical addressing allows efficient advertisement of routing information: Organization 0 00.3.6.0/3 Organization 00.3.8.0/3 Organization 00.3.0.0/3 Organization 7 00.3.30.0/3.... Fly-y-Night-ISP Send me anything with addresses beginning 00.3.6.0/0 Internet ISPs-R-Us Send me anything with addresses beginning 99.3.0.0/6 4: Network Layer 4a-39 Hierarchical addressing: more specific routes ISPs-R-Us has a more specific route to Organization Organization 0 00.3.6.0/3 Organization 00.3.0.0/3 Organization 7 00.3.30.0/3.... Organization 00.3.8.0/3 Fly-y-Night-ISP ISPs-R-Us Send me anything with addresses beginning 00.3.6.0/0 Send me anything with addresses beginning 99.3.0.0/6 or 00.3.8.0/3 Internet 4: Network Layer 4a-40
IP addressing: the last word... Q: How does an ISP get block of addresses? : INN: Internet orporation for ssigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes 4: Network Layer 4a-4 Getting a datagram from source to dest. IP datagram: misc fields source IP addr dest IP addr data datagram remains unchanged, as it travels source to destination addr fields of interest here routing table in Dest. Net. next router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3... 3..3. E 4: Network Layer 4a-4
Getting a datagram from source to dest. misc fields 3... 3...3 data Starting at, given IP datagram addressed to : look up net. address of find is on same net. as link layer will send datagram directly to inside link-layer frame and are directly connected Dest. Net. next router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3... 3..3. E 4: Network Layer 4a-43 Getting a datagram from source to dest. misc fields 3... 3...3 data Starting at, dest. E: look up address of E E on different, E not directly attached routing table: next hop router to E is 3...4 link layer sends datagram to router 3...4 inside linklayer frame datagram arrives at 3...4 continued.. Dest. Net. next router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3... 3..3. E 4: Network Layer 4a-44
Getting a datagram from source to dest. Dest. next misc fields 3... 3...3 data router Nhops interface 3.. - 3...4 rriving at 3..4, 3.. - 3...9 3..3-3..3.7 destined for 3... look up address of E 3... E on same as router s 3... interface 3...9 3... router, E directly attached 3...4 3...9 link layer sends datagram to 3... 3... inside link-layer 3...3 3..3.7 E frame via interface 3...9 3..3. 3..3. datagram arrives at 3...!!! (hooray!) 4: Network Layer 4a-45