1.56k likes | 1.62k Vues
The Network Layer. Design Issues Routing Algorithms Congestion Control Internetworking Example Network Layer Protocols. Goals of the Network Layer. The network layer is concerned with getting packets from the source all the way to the destination the network layer must
E N D
The Network Layer • Design Issues • Routing Algorithms • Congestion Control • Internetworking • Example Network Layer Protocols
Goals of the Network Layer • The network layer is concerned with getting packets from the source all the way to the destination • the network layer must • know the topology of the communication subnet • choose route to avoid overloading some of the communication lines and routers while leaving others idle • deal with problems when the source and destination are in different networks
Services Provided to the Transport Layer • Connectionless (unreliable) services • each packet must carry the full destination address • no packet ordering and flow control should be done • Connection-oriented (reliable) services • a network layer process on the sending site must set up a connection to its peer on the receiving side • when a connection is set up, two processes can enter a negotiation about service parameters • packets are delivered in sequence • flow control is provided automatically
International Organization of the Network Layer • virtual circuit • a route from the source to the destination is chosen as part of the connection setup • primarily for connection-oriented service • datagrams • each packet sent is routed independently of its predecessors • for connection-oriented and connectionless services
Combinations of Services and Subnet Structures Services provided by Transport layer Connection-oriented Connectionless Services provided to Transport layer Connection-oriented Connectionless Subnet Structures Virtual Circuit Datagram ATM AAL1 over ATM UDP Over IP Over ATM TCP over IP UDP over IP
Routing • Packets are often routed from the source to the destination hop by hop. • Two networks are connected by at least a router. The network is defined from the point of view of the network layer.
Types of Routing • Static Routing (Nonadaptive Routing) • Routes to destinations are predetermined and are not dependent on the current state (traffic, topology etc.) of the network. • Dynamic Routing (Adaptive Routing) • Routes being learned via exchange of routing information to reflect changes in the topology and traffic. • Default Routing: • Traffic to destinations that are unknown to the router is sent to a default “outlet”.
The Optimality Principle • If router J is on the optimal path from router I to router K, then the optimal path from J to K also falls along the same route. • the set of optimal routes from all sources to a destination form a tree, called a sink tree, rooted at the destination. • The goal of all routing algorithms is to discover and use the sink trees for all routers. r2 J r1 I K
Routing Algorithms • Static Routing Algorithms • Shortest Path Routing • Flooding • Flow-Based Routing • Dynamic Routing Algorithms • Distance Vector Routing • Link State Routing • Hierarchical Routing • Routing for Mobile Hosts • Broadcast Routing • Multicast Routing
Shortest Path Routing • Find the shortest path between a given pair of routers. • Cost of a link may be a function of the distance, bandwidth, average traffic, communication cost, mean queue length, delay, etc. • The Dijkstra’s algorithm is used.
Flooding • Every incoming packet is sent out on every outgoing line except the one it arrived on. • Vast numbers of duplicate packets are generated. • Application: • Concurrent updates of all distributed databases • Always choose the shortest path M I J K L
Flow-Based Routing • For a given line, if the capacity and average flow are known in advance, it is possible to compute the mean packet delay on that line from queuing theory. • The routing problem then reduces to finding a routing algorithm that produces the minimum average delay for the subnet.
Distance Vector Routing • RIP, the distributed Bellman-Ford routing algorithm, the Ford-Fulkerson algorithm • Each router maintains a routing table giving the best known distance to each destination and which line to use to get there. • These tables are updated by exchanging information with the neighbors.
Distance Vector • Each node maintains a set of triples • (Destination, Cost, NextHop) • Exchange updates directly connected neighbors • periodically (on the order of several seconds) • whenever table changes (called triggered update) • Each update is a list of pairs: • (Destination, Cost) • Update local table if receive a “better” route • smaller cost • came from next-hop • Refresh existing routes; delete if they time out
Example : router B Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A
Distance Vector Routing • Metric used to measure the “distance” • number of hops • time delay • queue length • Drawback • Count-to-infinity problem • it reacts rapidly to good news, but leisurely to bad news.
A B C D E A B C D E Count-to-Infinity Problem Initially After 1 exchange After 2 exchanges After 3 exchanges After 4 exchanges After 5 exchanges After 6 exchanges down initially and come up later alive initially and down later Good News Bad News
2 infinity 1 A B C infinity Split Horizon Hack • Try to solve the count-to-infinity problem • the distance to X is not reported on the line that packets for X are sent on (actually, it is reported as infinity) • In many cases, the bad news propagates one hop per exchange
2 infinity Infinity B thinks it can reach D through A with a cost of 2
Link State Routing • Each route must 1.Discover its neighbors and learn their network addresses. 2.Measure the delay or cost to each of its neighbors. 3.Construct a packet telling all it has just learned. 4.Send this packet to all other routers. 5.Compute the shortest path to every other router. • Strategy • send to all nodes (not just neighbors) information about directly connected links (not entire routing table)
Learning About the Neighbors • Send a special HELLO packet on each point-to-point line • the router on the other end is expected to send back a reply telling who it is HELLO I J L I am J K
Measuring Line Cost • Send an ECHO packet over a line • the other side is required to send back ECHO immediately • the round-trip delay can be measured • if the load is taken into account • results in better performance • the routing table may be oscillate wildly
Distributing Link State Packets • Use flooding • sequence number is used to determine among new, duplicate, or obsolete packets • three problems • sequence number may wrap around • a crash router will lose track of its sequence number when it restarts • a corrupted bit in sequence number may cause disaster
The Use of ‘Age’ Field • Include in each packet • decremented once per second • when the age hits zero, the information from that router is discarded • also decremented by each router during the initial flooding process • no packet can get lost and live for an indefinite period of time
Reducing Flooding Costs • When a link state packet comes in • it is put in a holding area to wait a short while • when another packet from the source comes in • duplicate: discarded • different: the older one is thrown out • all link state packets are acknowledged M I J K L
Computing the New Route • Once a router has accumulated a full set of link state packets • it can construct the entire subnet graph by locally running Dijkstra’s algorithm • for a subnet with n routers, each of which has k neighbors, the memory required to store the input data is proportional to kn.
Hierarchical Routing • When hierarchical routing is used, the routers are divided into regions • each router knows all the details about how to route packets to destinations within its own region • each router knows nothing about the internal structure of other regions.
Hierarchical Routing Dest. Line Hops 1A ---- --- 1B 1B 1 1C 1C 1 2A 1B 2 2B 1B 3 2C 1B 3 2D 1B 4 3A 1C 3 3B 1C 2 4A 1C 3 4B 1C 4 4C 1C 4 5A 1C 4 5B 1C 5 5C 1B 5 5D 1C 5 Region 1 Region 2 Dest. Line Hops 1A ---- --- 1B 1B 1 1C 1C 1 2 1B 2 3 1C 2 4 1C 3 5 1C 4 A B B C C A D B C A A D B A Hierarchical table for 1A B Region 5 C Region 3 Region 4 Full table for 1A
Optimal Hierarchical Number • Kamoun and Kleinrock • N routers • lnN hierarchical number • e lnN entries for each router • Increasing average length of routing path but the affection is acceptable
Routing for Mobile Hosts • Each mobile node is assumed to have a permanent home location that never changes. • Each area has one or more foreign agents, which keep track of all mobile nodes visiting the area. • In addition, each area has a home agent, which keep track of nodes whose home is in the area, but who are currently visiting another area. • When a new node enters an area, it must register itself with a foreign agent there. Then the mobile node will register either directly with its home agent, or through the foreign agent which forwards the registration to the home agent.
Routing for Mobile Hosts Home Foreign WAN, MAN, or LAN moving Foreign moving
Routing for Mobile Hosts • Datagrams sent to the mobile node are • intercepted by its home agent, then • tunneled by the home agent towards the mobile node, • received at the tunnel foreign agent, and • finally delivered to the mobile node.
Routing for Mobile Hosts 1. Packet is sent to the mobile host’s home 3. Sender is given foreign agent’s address 2. Packet is tunneled to the foreign agent 4. Subsequent packets are tunneled to the foreign agent
Broadcast Routing • To simply send a distinct packet to each destination • Flooding • Multidestination Routing • Spanning Tree Routing • Reverse Path Forwarding
Multidestination Routing • Each packet contains a list of desired destinations. • When a packet arrives, the router checks all the destinations to determine the set of output lines for forwarding the packet. An output line is selected if it is the best route to at least one of the destinations. • The router generates a new copy of the packet for selected output line, with a set of destinations that are to use the line.
Spanning Tree Routing • Assume each router has knowledge of a spanning tree (e.q. a sink tree) in the network. • Each router copies an incoming broadcast packet onto all the spanning tree lines except the one it arrives on. • Use minimum number of packets.
Reverse Path Forwarding • Without knowing any spanning tree if a packet arrives at the line that is normally used for sending packets to the source of the broadcast the router forwards copies of it onto all lines except the one it arrived on. otherwise the packet is discarded