* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download the network layer 1
Network tap wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Distributed firewall wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Backpressure routing wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Computer network wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Airborne Networking wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Deep packet inspection wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Packet switching wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Network Layer Chapter 5 • • • • • • Design Issues Routing Algorithms Congestion Control Quality of Service Internetworking Network Layer of the Internet Revised: August 2011 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 The Network Layer Responsible for delivering packets between endpoints over multiple links CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Application Transport Network Link Physical Network Layer Functionality Getting packets from the source all the way to the destination Lowest layer that deals with end-to-end transmission Must know the topology of the physical network TUNALI 3 Computer Networks 1 Design Issues • • • • • Store-and-forward packet switching » Services Provided to the Transport Layer Connectionless service – datagrams » Connection-oriented service – virtual circuits » Comparison of virtual-circuits and datagrams » CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Store-and-Forward Packet Switching Hosts send packets into the network; packets are forwarded by routers ISP’s equipment CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Services Provided to the Transport Layer Frequently, network layer is the interface between the carrier and the customer • Services should be independent of the router technology • Transport layer should be shielded from the topology of the routers present • Network Layer addressing should be uniform TUNALI 6 Computer Networks 1 Unreliable and connectionless Just two primitives • SEND PACKET • RECEIVE PACKET The complexity is in the transport layer (hosts) TUNALI 7 Computer Networks 1 Connectionless Service – Datagrams Packet is forwarded using destination address inside it • Different packets may take different paths ISP’s equipment A’s table (initially) A’s table (later) C’s Table E’s Table Dest. Line CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Connection-Oriented Service Properties • Set up a connection to receiver • Negotiate parameters • Packets are guaranteed to be delivered in sequence • Flow control provided Complexity is in the network layer TUNALI 9 Computer Networks 1 Connection-Oriented – Virtual Circuits Packet is forwarded along a virtual circuit using tag inside it • Virtual circuit (VC) is set up ahead of time ISP’s equipment A’s table C’s Table E’s Table In: Line Tag Line Tag: Out CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Internal Organization of Network Layer Virtual circuits • No need to choose a route for each packet Datagram • No routes are worked out in advance Note that the type of services provided to transport layer and internal organization of the network are different concepts • E.g. Network Layer may provide a connectionoriented service to transport layer even when it internally uses datagrams to move the packets around TUNALI 11 Computer Networks 1 Virtual Circuits Between the source and destination a path is established All the packets from the source to destination follow the same path Each router must remember where to forward packets for each of the currently open virtual circuits passing through it Each packet must contain a virtual circuit number field in the header for identification purposes Routers assign this number locally and maintain tables to determine which incoming packet with a particular number will be forwarded to which outgoing line TUNALI 12 Computer Networks 1 Datagrams Each packet must contain full destination address TUNALI 13 Computer Networks 1 Comparison of VC and Datagrams Router memory space for vc tables vs wasted bandwidth for extra long address in each packet header Set up time versus address parsing time Easier to control congestion with vc Datagram may be more suitable for transaction processing systems VC is vulnerable to crash of the router TUNALI 14 Computer Networks 1 Comparison of Virtual-Circuits & Datagrams CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Routing Algorithms (1) • • • • • • • • • • • Optimality principle » Shortest path algorithm » Flooding » Distance vector routing » Link state routing » Hierarchical routing » Broadcast routing » Multicast routing » Anycast routing » Routing for mobile hosts » Routing in ad hoc networks » CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Routing Algorithms (2) Routing is the process of discovering network paths • Model the network as a graph of nodes and links • Decide what to optimize (e.g., fairness vs efficiency) • Update routes for changes in topology (e.g., failures) Forwarding is the sending of packets along a path CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Routing Algorithm Properties Correctness Simplicity Robustness • What happens if the topology changes? Stability • Must converge to an equilibrium Fairness Optimality • Minimize mean packet delay • Maximize total network throughput TUNALI 18 Computer Networks 1 Classes of Routing Algorithms Nonadaptive algorithms • Route is computed in advance and stored in the router • This is called static routing Adaptive algorithms • Base their decision on current measurement of traffic and topology TUNALI 19 Computer Networks 1 The Optimality Principle Each portion of a best path is also a best path; the union of them to a router is a tree called the sink tree • Best means fewest hops in the example B Network Sink tree of best paths to router B CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Shortest Path Algorithm (1) Dijkstra’s algorithm computes a sink tree on the graph: • Each link is assigned a non-negative weight/distance • Shortest path is the one with lowest total weight • Using weights of 1 gives paths with fewest hops Algorithm: • Start with sink, set distance at other nodes to infinity • Relax distance to other nodes • Pick the lowest distance node, add it to sink tree • Repeat until all nodes are in the sink tree CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Shortest Path Algorithm (2) A network and first five steps in computing the shortest paths from A to D. Pink arrows show the sink tree so far. CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Shortest Path Algorithm (3) Initialize • • T = {s} set of nodes incorporated (s source) L(n)=w(i,j) for ns initial path costs to neighbors Get next node • • Add the neighbor x not in T that has least cost L(x) to s. Add the edge from this neighbor to old T that contributes to the path Update least cost paths • For all nT, update costs by L(n)=min[L(n),L(x)+w(x,n)] TUNALI 23 Computer Networks 1 Shortest Path Algorithm (4) ... Start with the sink, all other nodes are unreachable Relaxation step. Lower distance to nodes linked to newest member of the sink tree ... CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Shortest Path Algorithm (5) ... Find the lowest distance, add it to the sink tree, and repeat until done CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Flooding A simple method to send a packet to all network nodes Each node floods a new packet received on an incoming link by sending it out all of the other links Nodes need to keep track of flooded packets to stop the flood; even using a hop limit can blow up exponentially CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Flooding (2) Every incoming packet is sent out on every outgoing line except the one it arrived on Generates vast number of duplicate packets Solutions • • Put a hop counter to every packet Avoid flooding the same packet second time − Needs packet sequence numbers • Use selective flooding − Do not put the packet to every outgoing line, instead put the packet to certain outgoing lines Used in military applications and measurements TUNALI 27 Computer Networks 1 Distance Vector Routing (1) Distance vector is a distributed routing algorithm • Shortest path computation is split across nodes Algorithm: • Each node knows distance of links to its neighbors • Each node advertises vector of lowest known distances to all neighbors • Each node uses received vectors to update its own • Repeat periodically CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Distance Vector Routing 2 Each router maintains a table that contains the following for each destination • Best known distance to the destination − Number of hops or − Time delay in milliseconds or − Total number of packets queued along the path • Which line to use to get there Each router is assumed to know the distance to each of its neighbors TUNALI 29 Computer Networks 1 Distance Vector Routing 3 Once every T msec, each router sends to each neighbor a list of its estimated delays to each destination A router, knowing the distance to its neighbor, can calculate distances to all destinations via its respective neighbor Then, it can choose the minimum distance and forward packets via that neighbor TUNALI 30 Computer Networks 1 Distance Vector Routing (4) Network New vector for J Vectors received at J from Neighbors A, I, H and K CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 The Count-to-Infinity Problem 1 Failures can cause DV to “count to infinity” while seeking a path to an unreachable node X Good news of a path to A spreads quickly Bad news of no path to A is learned slowly CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 The Count-to-Infinity Problem 2 In distance vector routing • Good news travel fast − One hop per exchange − Within N (number of nodes) exchanges, everyone will know about new changes • Bad news travel slow − Count-to-Infinity problem » Routers increase their costs by a value of one to reach infinity TUNALI 33 Computer Networks 1 Link State Routing (1) Link state is an alternative to distance vector • More computation but simpler dynamics • Widely used in the Internet (OSPF, ISIS) Algorithm: • Each node floods information about its neighbors in LSPs (Link State Packets); all nodes learn the full network graph • Each node runs Dijkstra’s algorithm to compute the path to take for each destination CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Link State Routing 2 Distance vector routing • Did not take line bandwidth into account • Took too long to converge Link state routing: Each router • Discover its neighbors, learn their network address. • Measure the delay or cost to each of its neighbors. • Construct a packet telling all it has just learned. • Send this packet to all other routers. • Compute the shortest path to every other router. TUNALI 35 Computer Networks 1 Learning about the Neighbors When a rooter is booted, it sends HELLO packet to all of its neighbors Neighbors reply by sending their globally unique names Modeling LANs need extra mechanisms • In the next slide an artificial node N is added to represent the LAN − From A to C, the path is represented as ANC TUNALI 36 Computer Networks 1 Learning about the Neighbors 2 (a) Nine routers and a LAN. (b) A graph model of (a). TUNALI 37 Computer Networks 1 Measuring Line Cost Each router should know an estimate of delay to each of its neighbors To estimate the delay, a router can send an echo packet to its neighbor and measure the time when it receives it back While measuring time, it is possible to include or exclude the time the echo packet spends on the queues which corresponds to consider load on the line Including load may cause oscillations in the algorithm TUNALI 38 Computer Networks 1 Building Link State Packets Packets contain • Identity of the sender • Sequence number • Age • List of neighbors and delays Packets can be issued • Periodically or • When a significant event occurs TUNALI 39 Computer Networks 1 Link State Routing (3) – LSPs LSP (Link State Packet) for a node lists neighbors and weights of links to reach them Network LSP for each node CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Distributing the Link State Packets Flooding is used Packet sequence numbers are used to discard duplicates or old packets by holding packets for a short while before flooding them 32-bit sequence numbers are used to prevent wrap-arounds For each packet, in addition to sequence number, age is used and decremented every second to solve • • Router crash problem Corrupted sequence number problem TUNALI 41 Computer Networks 1 Link State Routing (4) – Reliable Flooding Seq. number and age are used for reliable flooding • New LSPs are acknowledged on the lines they are received and sent on all other lines • Example shows the LSP database at router B CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Computing the New Routes When a router accumulates a full set of link state packets, it can construct the entire network graph It then runs Dijkstra’s algorithm to construct shortest paths to all possible destinations Even for a large subnet, the memory requirements are reasonable Malfunctioning routers may cause problems Protocols using link state routing • OSPF and IS-IS TUNALI 43 Computer Networks 1 Hierarchical Routing As networks grow • Routing table memory requirements increase • CPU time to execute routing algorithm increases Solution: Use hierarchical routing • Routers are divided into regions • A router knows every detail about its region but knows nothing about other regions • Each region is represented by a “monitor” router • Monitor routers form a higher level in hierarchy TUNALI 44 Computer Networks 1 Hierarchical Routing 2 Hierarchical routing reduces the work of route computation but may result in slightly longer paths than flat routing Best choice to reach nodes in 5 except for 5C CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Hierarchical routing (3) Path length increases How many levels should the hierarchy have? • If there are N nodes, the optimal number of levels is ln N TUNALI 46 Computer Networks 1 Broadcast Routing Broadcast • Sending a packet to all destinations simultaneously Broadcast method 1: • Send a distinct packet to each destination • Needs addresses of destinations and wastes bandwidth Broadcast method 2: • Flooding TUNALI 47 Computer Networks 1 Broadcast Routing 2 Broadcast method 3: • Multidestination routing − Each packet contains a list of destinations − A router receiving a packet checks the destinations and determines the output lines needed − The router generates a new packet for each output line and modifies the destination list by including only those destinations that are on that particular line TUNALI 48 Computer Networks 1 Broadcast Routing (3) Broadcast method 4: • Spanning tree − A subset of network that includes all routers but contains no loops − Each router knows which of its lines belong to the spanning tree (this is an important restriction) − Any incoming packet on a spanning tree line is forwarded to all other spanning tree lines TUNALI 49 Computer Networks 1 Broadcast Routing (4) Broadcast method 5: • Reverse Path Forwarding − No need to know the spanning tree − When a broadcast packet arrives, the router checks to see if it arrived on the line that it uses forwarding packets to the source node of the broadcast − If yes, it forwards the packets to all other lines except the one it arrived on. − If no, it discards the packet, considering that the packet did not arrive through optimal route. − Simple and efficient TUNALI 50 Computer Networks 1 Broadcast Routing 5 Broadcast sends a packet to all nodes • RPF (Reverse Path Forwarding): send broadcast received on the link to the source out all remaining links • Alternatively, can build and use sink trees at all nodes Network Sink tree for I is efficient broadcast RPF from I is larger than sink tree CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Multicast Routing Process Groups • A set of processes that work in an interactive manner Multicasting • Sending message to a group Multicast Routing • Routing of multicast messages Group Management • Creating and destroying groups • Processes join and leave groups TUNALI 52 Computer Networks 1 Multicast Routing (2) Routers need to know which host belongs to which group Each router needs to compute a spanning tree covering all other routers in the group subnet Multicast messages are forwarded only along the appropriate spanning tree Link state or distance vector approaches are used to disseminate topology information Pruning • Forming the spanning tree for a group Pruning by link state routing • Each router knows the complete topology TUNALI 53 Computer Networks 1 Multicast Routing (3) – Dense Case Multicast sends to a subset of the nodes called a group • Uses a different tree for each group and source S Network with groups 1 & 2 S Spanning tree from source S S Multicast tree from S to group 1 Multicast tree from S to group 2 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Multicast Routing (4) – Sparse Case CBT (Core-Based Tree) uses a single tree to multicast • Tree is the sink tree from core node to group members • Multicast heads to the core until it reaches the CBT p 1. Sink tree from core to group 1 Multicast is send to the core then down when it reaches the sink tree CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Multicast Routing (5) Pruning by distance vector routing • Use reverse path forwarding to eliminate routers that reject that particular group communication • Scales poorly TUNALI 56 Computer Networks 1 Anycast Routing Anycast sends a packet to one (nearest) group member • Falls out of regular routing with a node in many places Anycast routes to group 1 Apparent topology of sink tree to “node” 1 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Routing for Mobile Hosts To route a packet to a mobile host, the network first has to find it Classification of users • • Stationary: Never move Mobile: They move − Migratory: They move but physically connect to network somewhere − Roaming: They maintain connection as they move around Locations • • Home Foreign TUNALI 58 Computer Networks 1 Routing for Mobile Hosts (2) Each area has • Home agent − Keeps track of users whose home is in the area • Foreign agent − Keeps track of all mobile users who are visiting the area TUNALI 59 Computer Networks 1 Routing for Mobile Hosts (3) Each mobile host entering a foreign area must register with the foreign agent of that area as follows • Mobile host provides foreign agent − Its home address − Current data link address − Security information • • • Foreign agent contacts mobile host’s home agent and report the presence of the mobile host in its region The home agent confirms security information and permits proceed Foreign agent registers the mobile host TUNALI 60 Computer Networks 1 Encapsulation and Tunneling After registration, • Any packet sent to the mobile host is intercepted by the home agent • The packet is encapsulated by the home agent and sent to the foreign agent • The home agent also informs the sender of the packet about the new address of the mobile host • Subsequent packets are directly sent to the mobile host (tunneling) TUNALI 61 Computer Networks 1 Routing for Mobile Hosts 4 Mobile hosts can be reached via a home agent • Fixed home agent tunnels packets to reach the mobile host; reply can optimize path for subsequent packets • No changes to routers or fixed hosts CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Routing in Ad Hoc Networks Possibilities when the routers are mobile: Military vehicles on battlefield. • No infrastructure. A fleet of ships at sea. • All moving all the time Emergency works at earthquake . • The infrastructure destroyed. A gathering of people with notebook computers. • In an area lacking 802.11. TUNALI 63 Computer Networks 1 Routing in Ad Hoc Networks 2 The network topology changes as wireless nodes move • Routes are often made on demand, e.g., AODV (below) A’s starts to find route to I A’s broadcast reaches B & D B’s and D’s broadcast reach C, F & G CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 C’s, F’s and G’s broadcast reach H & I Route Discovery Request ID • • Incremented each time a ROUTE REQUEST is broadcast Other nodes check source address and request id and discard duplicates Source sequence # • Each node maintains a second counter that is increased whenever a Route Request is sent or someone else’s Route Request is replied Dest. Sequence # • Most recent value of I’s sequence number that A has seen TUNALI 65 Computer Networks 1 AODV Algorithm A node receiving ROUTE REQUEST examines source address and request ID and discards it if it is a duplicate Looks up for destination in its route table. If fresh route is known, a ROUTE REPLY packet is sent back to source Else, increases hop count and broadcasts the packet It also stores the data in its reverse route table TUNALI 66 Computer Networks 1 Reading 5-1 5-2 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Homework 5 (6) 9 (11) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011