Chapter h 6 Th Network The N kL Layer 1 Network Layer y Design g Isues • • • • • Store-and-Forward Packet Switching Services Provided to the Transport Layer Implementation of Connectionless Service Implementation of Connection-Oriented Service p of Virtual-Circuit and Datagram g Subnets Comparison 2 Store-and-Forward Packet Switching g fig 5-1 The environment of the network layer protocols. protocols 3 4 5 Implementation p of Connectionless Service Routing within a diagram subnet. subnet 6 Implementation of Connection-Oriented Service Routing within a virtual virtual-circuit circuit subnet. subnet 7 8 Comparison of Virtual-Circuit and Datagram Subnets 54 5-4 9 Routing algorithms can be grouped into two classes: nonadaptive and adaptive 10 Routing g Algorithms g • • • • • • • • • The Optimality p y Principle p Shortest Path Routing Flooding Distance Vector Routing Link State Routing Hierarchical Routingg Broadcast Routing Multicast Routing Routing for Mobile Hosts 11 Routing g Algorithms g (2) ( ) Conflict between fairness and optimality. optimality 12 13 The Optimality p y Principle p (a) A subnet. (b) A sink tree for router B. 14 15 Shortest Path Routing g The first 5 steps used in computing the shortest path from A to D. D The arrows indicate the working node. 16 Flooding Flooding Algorithm: Every incoming packet is sent out on every outgoing line except the one its arrived on Methods for damming the flood (a) hop count (b) keeping track of which packets have been flooded (list of sequence numbers) Modified flooding algorithm: Selective flooding Application of the flooding algorithm (a) military (b) distribution of database (c) wireless networks (d) bench mark for other algorithm (shortest path) 17 Distance Vector Routing 1. Each router maintains a routing table, whose entry contains two parts: the preferred outgoing line to use for that destination and an estimate of the time or distance to that destination 2. The router is assumed to know the distance to each of its neighbors 3. Each router sends the routing table (destination, distance) to each neighbor i hb 4 Based 4. B d on the h collected ll d routing i tables bl from f the h neighbors, i hb the h router computes the shortest distance for each destination and update the routing table 18 Distance Vector Routing g (a) A subnet. (b) Input from A, I, H, K, and the new routing table for J. 19 Distance Vector Routing g ((2)) • Good news propagates fast • Routers may take infinite number of exchanges t know to k bad b d news ((a router t was d down)) The count-to-infinity problem. 20 Link State Routing g Each router must do the following: g 1. Discover its neighbors, learn their network addresses. 2 Measure 2. Meas re the delay dela or cost to each of its neighbors. neighbors 3. Construct a packet telling all it has just learned. 4. Send this packet to all other routers. p the shortest ppath to every y other router. 5. Compute 21 Learning g about the Neighbors g • The LAN is modeled as a node ((artificial)) (a) Nine routers and a LAN. LAN (b) A graph model of (a). (a) 22 Measuring g Line Cost • A special ECHO packet is sent to the other side to measure the delay ((with / without taking g the load into account)) A subnet in which the East and West parts are connected by two lines. 23 24 25 26 27 6 6- 6- 6 16 6-16 28 Distributing g the Link State Packets • Flooding is used to distribute the link state packet Over a router has accumulates a full set of link state packet, it can construct the entire subnet graph and compute the shortest path. The packet buffer for router B in the previous slide (Fig. 6-13). 29 Hierarchical Routing g Hierarchical routing. routing 30 31 6-21 6-21 6-21 6-21 32 Multicast Routing g (a) A network network. (b) A spanning tree for the leftmost router router. (c) A multicast tree for group 1. (d) A multicast tree for group 2. 33 Broadcast Routing g Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding. 34 6-18 35 36 37 Routing g for Mobile Hosts ((2)) Packet routing for mobile users. users 38 Routing g in Ad Hoc Networks Possibilities P ibili i when h the h routers are mobile: bil 1. Military y vehicles on battlefield. – No infrastructure. 2. A fleet of ships at sea. – All moving all the time 3. Emergency works at earthquake . – The infrastructure destroyed. destroyed 4. A gathering of people with notebook computers. – I an area lacking In l ki 802.11. 802 11 39 Route Discovery y a) (a) Range of A's broadcast. b) (b) After B and D have received A's broadcast. c) (c) After C, F, and G have received A's broadcast. d) (d) After E, H, and I have received A's broadcast. Shaded nodes are new recipients. Arrows show possible reverse routes. 40 Route Discovery y ((2)) Format of a ROUTE REQUEST packet. 41 Route Discovery y ((3)) Format of a ROUTE REPLY packet. 42 Route Maintenance (a) D D'ss routing table before G goes down. (b) The graph after G has gone down. 43 Node Lookup p in Peer-to-Peer Networks ( ) A sett off 32 node (a) d identifiers id tifi arrangedd in i a circle. i l The Th shaded h d d ones correspond to actual machines. The arcs show the fingers from nodes 1,, 4,, and 12. The labels on the arcs are the table indices. (b) Examples of the finger tables. 44 Congestion g Control Algorithms g • • • • • • General Principles of Congestion Control Congestion Prevention Policies Congestion Control in Virtual-Circuit Subnets C Congestion ti Control C t l in i Datagram D t Subnets S b t Load Shedding g Jitter Control 45 Congestion g When too much traffic is offered, offered congestion sets in and performance degrades sharply. 46 General Principles p of Congestion g Control 1. Monitor the system . – detect when and where congestion occurs occurs. 2. Pass information to where action can be taken. 3. Adjust system operation to correct the problem. 47 Congestion g Prevention Policies (timeout interval) 5-26 (input /output queue) (timeout interval) (selective repeat) (response time) Policies that affect congestion. congestion 48 Congestion Control in Virtual-Circuit Subnets a. Admission control (no more new VC will be setup) b New VCs are allowed only to bypass the congestion areas b. c. Resources (bandwidth, buffer,..) reservation (a) A congested subnet. subnet (b) A redrawn subnet subnet, eliminates congestion and a virtual circuit from A to B. 49 Congestion control in datagram subnets a. Each router estimates the availability of each output line. unew = auold + (1 − a ) f a: updating period f: utilization of the line b Whenever b. Wh u moves above b the th threshold, th h ld some action ti will ill be taken c. The warning bit method d. Choke p packets ((to source)) e. hop-by-hop choke packets 50 Hop-by-Hop Hop by Hop Choke C o e Packets ac ets (a) A choke packet that affects only the source. (b) A choke packet that affects eachh hop h it passes through. th h 51 Load shedding (discarding packets) a. b. c. d. wine i policy li (minimize ( i i i retransmission) t i i ) milk policy (for multimedia, new is better) priority (discarding low priority packets) ( wired subnet,, the router Random Earlyy Detection (for discards the packets randomly, and the source should response p lost ppackets byy slowingg down the transmission rate) 52 Jitter Control • Jitter control is important for audio and video applications a. Routers adjust the transmission order of output packets b. For video on demand packets can be buffered at the receiver in advance (a) High jitter. (b) Low jitter. 53 Quality Q y of Service • • • • • Requirements q for Achievingg Good Q Quality y of Service Techniques Integrated Services Differentiated Services Label Switching and MPLS 54 Requirements q 5-30 How stringent the quality quality-of-service of service requirements are. are 55 ATM networks classify flows into four categories: 1. Constant bit rate (telephony) 1 2. Real-time variable bit rate ( compressed video) 3. Non-real-time variable bit rate (movie over Internet) 4. Available bit rate ((file transfer)) 56 Techniques q for Achieving g Good QOS 1. 2. 3 3. 4. 5. 6. 7. 8 8. 9. Over provisioning (over supply) Buffering T ffi shapping Traffic h i (agreement ( t on certain t i traffic t ffi pattern) tt ) The leaky bucket algorithm The token bucket algorithm Resource reservation Admission control P Proportional ti l routing ti Packet scheduling 57 Buffering g Smoothing the output stream by buffering packets. packets 58 59 60 61 The Leaky Bucket Algorithm (a) Input to a leaky bucket. (b) Output from a leaky bucket Output from a token bucket. bucket with capacities of (c) 250 KB,, ((d)) 500 KB,, ((e)) 750 KB, (f) Output from a 500KB token bucket feeding a 10-MB/sec / leaky l k bucket. b k 62 63 Resource reservation Th different Three diff t ki kinds d off resources can be b reservedd • • • Bandwidth p Buffer space CPU cycles 64 Because of random arrivals, and random service time distribution, queues can build b ild up andd delays d l can occur. Consider that packets arrives with Poisson distribution with mean λ packet/sec, k t/ the th service i time ti is i exponential ti l with ith μ packet/sec. k t/ The CPU can be modeled as an M/M/1 queue. Th delay The d l is i given i as ρ λ T = ρ = λ (1 − ρ ) μ 1 1 = μ 1− ρ For example = λ = 950000 packets / sec μ = 1000000 packets / sec ρ = 0.95 T = 20 μ sec onds 65 Admission Control When the incomingg traffic from some flow is well shaped, p , the capacity can be reserved in advance on the routers along the path. p When a flow with flow specification (produced by the sender) is offered offered, the router along the router examines the flow specification and modifies the parameters as need be. Finally the acceptable flow specification (acceptable parameters) can be established. 66 An example of flow specification 5-34 maximum sustained rate average g over a long time interval maximum capacity of the bucket maximum i ttolerated l t d transmission rate 〉 related to protocols and processing time A router will map the parameters to a set of specific ifi resource reservations ti 67 Proportional Routing To provide a high quality of service service, the traffic can be split over multiple routes. A simple method is to divide the traffic equally or in proportion to the capacities of the outgoing links. 68 Packet Scheduling g 1. Fair queueing algorithm The router has separate queues for each output line, one for each flow. When a li b line becomes idl idle, th the router t scans th the queues round d robins, bi ttaking ki th the fifirstt packet on the nest queue. 2. Weighted fair queueing algorithm * for priority service (e.g. giving some servers more bandwidth) (a) A router with five packets queued for line O. O (b) Finishing times for the five packets. 69 Integrated g Services I was aimed It i d at both b h unicast i (streaming ( i video) id ) andd multicast li (digital television broadcasting) applications In many multicast applications groups can change membership dynamically. Under these conditions, the approach of having the senders reserve bandwidth in advance dose not work well. If the number of receivers are large, the dynamical grouping dose not work at all. 70 Integrated Services (flow-based algorithms) RSVP-The ReSerVation Protocol (a) A network network, (b) The multicast spanning tree for host 1. 1 (c) The multicast spanning tree for host 2. 71 RSVP-The ReSerVation Protocol (2) ( ) Already reserved When Host5 requests, new reservation is needed d d (a) Host 3 requests a channel to host 1. 1 (b) Host 3 then requests a second channel, to host 2. (c) Host 5 requests a channel to host 1. 72 Differentiated services (class-based) ( ) Differentiated Service (DS) can be offered by a set of routers forming an administrative domain (e.g. (e g an ISP or a Telco). Telco) The administration defined a set of service classes with corresponding forwarding rules rules. Some classes (e.g. (e g premium service) with higher requirements may has better service than others. others DS scheme does not require advance setup, resource reservation or time consuming end-to-end negotiation for each flow. flow This makes DS relatively easy to implement. For example example, the operator reserves resources for all IP-phone IP phone users (the IP-phone class), on contrary, a flow-based scheme each phone call gets its own resources and scheme, 73 guarantees. Differentiated Services (class-based service) Expedited Forwarding • Two queues for each output line, one for expedited packets and one for regular packets Expedited packets experience a traffic-free network. 74 Assured Forwardingg The assured forwarding scheme which manages the service classes, l specifies ifi three h packet k di discard d probabilities b bili i andd four priority classes, each class having its own resources. Taken together, three two factors define 12 service classes. p procedure p Implementation 1. Classify the packets into one of the four classes (on the sending host or the ingress router) 2. Mark the packets (type A service in IP, which is specified in the type of service field) 3. Pass the packets through a shaper/dropper filter (e.g. leaky b k t or token buckets t k buckets) b k t) 75 Assured Forwarding g A possible implementation of the data flow for assured forwarding. forwarding 76 Label Switchingg and MPLS This scheme adds a label in front each packet and does the routing based on the label rather than on the destination address. address Making the label an index into an internal table makes finding the correct output line becomes just a matter of table lookup. ( 225, A (X, ATM, fframe relay l andd virtual i l circuits i i did the h similar i il thing) 77 Label Switching g and MPLS • A new MPLS header is added in front of the IP header. • On a router-to-router line using PPP as the framing protocol • MPLS is layer 2.5 s: stacking multiple labels in hierarchical networks TTL: Time To Live Transmitting a TCP segment using IP, MPLS, and PPP. 78 1. MPLS headers are not p part of the network layer y packet p or the data link layer frame 2 It is possible to build MPLS switches that can forward 2. both IP packets and ATM cells 3 In the MPLS router 3. router, the label is used as an index into a table to determine the outgoing line to use and the new label to be used (label swapping) 4. The router may group multiple flows that end at a particular ti l router t (LAN) andd use a single i l label l b l (Forwarding (F di Equivalence Class, FEC) 5. No setup is needed for MPLS routing 79 6. Two ways to create the forwarding table. D t di Data-driven: The Th hit router t asks k the th router t downstream d t to t generate a label for the flow (for ATM subnet) C Control-driven: ldi The Th router checks h k to see for f which hi h routers it i is i the final destination. It then creates one or more FECs for them, allocates a label for each one, one and passes the labels in their forwarding table and send new ones to their neighbors. 7 A packet may carry an entire stack of labels. 7. labels The S bit is set to 1 for the bottom label and 0 for all the other labels. 80 Internetworking g • • • • • • • How Networks Differ How Networks Can Be Connected Concatenated Virtual Circuits Connectionless Internetworking Tunneling Internetwork Routing Fragmentation 81 82 Connecting g Networks A collection of interconnected networks. networks 83 How Networks Differ 5-43 Some of the many ways networks can differ. 84 85 How Networks Can Be Connected (a) Two Ethernets connected by a switch. (b) Two Ethernets connected by routers. 86 87 88 89 90 Each network in an internetwork is independent and is often referred to as an Autonomous System (AS) 91 92 Fragmentation g (a) Transparent fragmentation. (b) Nontransparent fragmentation. 93 Fragmentation g ((2)) Fragmentation when the elementary data size is 1 byte. (a) Original packet, containing 10 data bytes. (b) Fragments after passing through a network with maximum packet size of 8 payload bytes plus header. header (c) Fragments after passing through a size 5 gateway. 94 The Network Layer y in the Internet • • • • • • • • The IP Protocol IP Addresses Internet Control Protocols OSPF – The Interior Gateway Routing Protocol BGP – The Exterior Gateway Routing Protocol Internet Multicasting Mobile IP IPv6 95 96 Design g Principles p for Internet 1. 2. 3 3. 4. 5 5. 6. 7. 8 8. 9. 10 10. Make sure it works. Keep it simple. Make clear choices. choices Exploit modularity. E Expect heterogeneity. h i Avoid static options and parameters. (negotiation is preferred) Look for a good design; it need not be perfect. Be strict when sending and tolerant when receiving receiving. Think about scalability. C id performance Consider f andd cost. 97 Collection of Subnetworks The Internet is an interconnected collection of many networks. 98 Fragment g offset: Tell where in the current datagram g this fragment g belongs g ((A 13 maximum of 2 =8192 fragments per datagram) 99 Time to line: Packet lifetime ≤ 255 seconds The IP Protocol (2) ( ) 5-54 Some of the IP options. options 100 ICANN (I (Internet t tC Corporation ti ffor A Assigned i dN Names and Numbers) 101 102 Subnets Gettingg a new network address would be hard to do since network addresses are scarce. The problem is the rule that a single g class A,, B or C address refers to on network,, not to a collection of LANs. To solve this problem is to allow a network to be split p into several parts p for internal use but still act like a single network to the outside world. In the Internet literature,, the pparts of the network ((e.g. g Ethernets)) are called subnets. (Do not confuse with subnet used elsewhere)) 103 Subnets A campus network consisting of LANs for various departments. departments 104 Subnets (2) ( ) To implement subnetting, the main router needs a subnet mask that indicates the split p between network +subnet number and host. Subnet masks are also written in dotted decimal notation or (/number of bits). For example, the original 16-bit host number is split into 6-bit subnet number and 10-bit host number allowing for up to 64 Ethernets number, Ethernets, each with maximum of 1022 hosts (0 and -1 are not available) A class B network subnetted into 64 subnets. subnets 105 106 CDR – Classless InterDomain Routing g The Internet is rapidly running out of IP addresses. One solution is CIDR which allocates the remaining IP addresses in variable-singed blocks. If a site needs 2000 addresses, it is given a block of 2048 addresses. For example, a set of IP addresses assignments is given as follows. A set of IP address assignments assignments. 107 Dropping the classes makes forwarding more complicated. The network-based forwarding scheme is no longer applicable. applicable A table look look-up up with address matching forwarding algorithm is devised. When the set of IP address is assigned to the three universities: Cambridge, Edinburgh and dO Oxford. f d The router uses the mask to get the value which only matches Oxford address as 11000010 00011000 00010000 00000000 The Oxford entry is used and the packet is sent along the line going to Oxford. A remote router, say Omaha, Nebraska, may use a single aggregate entry with a binary address dd and d submask. b k 108 NAT – Network Address Translation • IP addresses are scarce. NAT is a quick fix. Each company is a assigned a few IP addresses for Internet traffic. Within the company, every computer gets a unique IP address for intramural traffic No p packets containing g these addresses may y appear pp on the Internet. • There are three reserved ranges. Most IP packets carry TCP or UPD payload, which have source port and destination port. NAT box will establish translation table based on the TCP or UPD source port and destination port. Placement and operation of a NAT box. 109 NAT can quickly solve the IP address shortage problem (even for ADSL cable modem application) ADSL, Here are some of the objections 1 NAT violates the architectural model of IP, 1. IP i.e. i e every IP address identifies a single machine worldwide 2 NAT establish the translation table, 2. table which changes the Internet from connectionless to a kind of connection-oriented network 3. NAT violates the layer structure 4. NAT can only handle IP packets with TCP or UDP payload, not others 5. NAT will not work when IP addresses are inserted in the body of the text (e.g. FTP, H.323) 6. Each IP address can only map up to 65536-4096=61440 machines 7. Delay the implantation of IPV6 110 Internet Control Protocols (ICP) ICP includes ICMP ICMP, ARP ARP, RARP RARP, BOOTP BOOTP, and DHCP Internet Control Message Protocol (I CMP) ICMP is used to test the internet and to report unexpected events. 5-61 Each ICMP message type is encapsulated in an IP packet. The principal ICMP message types. 111 112 When Host1 (E1) sends a packet to a user on Host2 (192.31.65.5) by e-mail. The Domain Name System (DNS) will find the e-mail address corresponding to IP address 192.31.65.5. send all traffic for host 4 to the router, and this solution is called proxy ARP. 114 RARP, BOOTP, and DHCP Given an Ethernet address, what is the corresponding IP address? Reverse Address Resolution Protocol (RARP) allows a newlybooted workstation to broadcast its Ethernet address. The RARP server sees the request, looks up the file and sends back the corresponding IP address. RARP server is needed on each network, because the router will not forward the broadcost (all 1’s) packet. BOOTP uses UDP messages, however BOOTP requires manual configuration of tables mapping IP address to Ethernet address. 115 Dynamic Host Configuration Protocol (DHCP) DHCP allows both manual IP assignment and automatic assignment. agent Operation of DHCP. 116 OSPF-The Interior Gateway Routing Protocol Design g pprinciples p 1. published algorithm 2 support variety of distance metrics 2. metrics, including physical distance, delay, etc. 3 dynamic, 3. d i adapting d ti to t changes h 4. support routing based on type of service 5. Do load balancing (load splitting) 6. support for hierarchical systems 7. security 117 6 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 Flow label will be used to allow a source and destination to setup pap pseudo connection Next header tells which of the six extension headers Fig. The IPv6 fixed header (required) 133 IPv6 address 134 135 Extension Headers (2) ( ) To support of datagram exceeding 64KB The hop-by-hop extension header for large datagrams (jumbograms). 136 Extension Headers (3) ( ) The routing header lists one or more routers that must be visited •The next header tells which of the six extension headers follow this one. If this header is the last IP header, then the Next header tells which transport protocol handler to pass the packet to •The routing type field gives the format of the rest of the header. The segments left field keeps track of how many addresses have not yet been visited. When it hits 0, the packet i on it is its own ((no more guidance). id ) The extension header for routing. 137