630 likes | 676 Views
Chapter 5 Network Layer. Dr. K. Raghava Rao Professor, Dept. of ECM raghavarao@kluniversity.in. network data link physical. network data link physical. network data link physical. network data link physical. network data link physical. network data link physical. network
E N D
Chapter 5 Network Layer Dr. K. Raghava Rao Professor, Dept. of ECM raghavarao@kluniversity.in
network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical Network Layer application transport network data link physical • Functions: • Routing issues • determine “good” path (sequence of routers) thru network from source to dest. • Congestion (Not Contention!) • More packets enter an area than can be processed • Internetworking • connecting different network technologies together • Network layer protocols in everyhost, router application transport network data link physical
Network Layer Design Issues • Store-and-forward packet switching • Services provided to transport layer • Implementation of connectionless service • Implementation of connection-oriented service • Comparison of virtual-circuit and datagram networks
Network layer design issues • Store-and-Forward packet switching • After each reception checksum is done in router and a new packet is transmitted to the next router. 1
Network layer design issues • Services provided to transport layer • Independent of subnet technology • Transport layer shielded from number, type, and topology of subnets • Uniform network address numbering • Even across LANs and WANs
Network layer design issues • Two basic kind of services • Connectionless (routers only send and receive packets) • Packets also called datagram • This kind of network is also called datagram subnet • Connection oriented (error control and flow control is done end to end) • Virtual circuit should set up before sending packets • This kind of network is also called virtual circuit subnet
No call setup at network layer Packets forwarded using destination host address packets between same source-dest. pair may take different paths Use in Internet application transport network data link physical application transport network data link physical Connectionless: Datagram 2. Receive Data 1. Send Data
Connectionless: Datagram • Routing within a diagram subnet: Store-and-Forward packet Subnet The table of router A is changed because of some reasons! Management and update this tables for routing = Routing algorithm Routing tables
Call setup, do for each call before data can flow Each packet carries VC identifier Used in ATM, frame-relay, X.25 application transport network data link physical application transport network data link physical Connection Oriented-Virtual Circuits 6. Receive data 3. Accept call 2. Incoming call 5. Data flow begins 4. Call connected 1. Initiate call
Virtual Circuits • Routing within a virtual-circuit subnet:
Routing Algorithms • The network layer is responsible for routing packets from the source to destination. • The routing algorithm is the piece of software that decides where a packet goes next (e.g., which output line, or which node on a broadcast channel). • For connectionless networks, the routing decision is made for each datagram. For connection-oriented networks, the decision is made once, at circuit setup time. • The routing algorithm must deal with the following issues: • Correctness, simplicity, stability, fairness and optimality • Minimizing mean packet delay or maximizing total network throughput • Routing is different from Forwarding!: • Forwarding: Select the output path using routing table • Routing: Management and updating the routing tables
Desirable properties of the routing algorithms: • Correctness: • Simplicity: for efficiency • Robustness: must be able to sustain the changes in the networks (cannot just rely on reboot) • Stability: should converge to equilibrium • Fairness: every one gets to send • Optimality: (Selection of Best Route)as efficient as possible
Routing Algorithms Conflict between fairness and optimality. If traffic flows between A and A’, B and B’, and C and C’, the utilization of the network will be good, but flow between X and X’ will be severely restricted. Fairness must often be imposed at the expense of overall utilization.
Optimality Principle • 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. • This means: • Given the final destination, routers only need to know the optimal route to the next router. • Construct a sink tree with the destination to be root. • The goal of all routing algorithms is to discover and use the sink tree for all routers. • Since it is a tree, there is no loops. • There would be different sink trees for each final destination.
The Optimality Principle (a) A subnet. (b) A sink tree for router B.
Routing • There are two types: • Static (Non-Adaptive) • routes never update or update slowly over time • Examples: Dijkstra, Flooding algorithm • Dynamic (Adaptive) • routes update more quickly use dynamic information of current topology such as load, delay, … • Examples: Distance Vector, Link State Routing • From another view: • Global: all routers have complete topology, link cost info • Decentralized: router knows physically-connected neighbors
Routing Algorithms • Shortest Path Routing (Dijkstra’s) • Flooding • Distance Vector Routing • Link State routing • Hierarchical routing • Broadcast routing • Multicast routing • Routing for mobile hosts • Routing in Ad Hoc Networks
Non-Adaptive Algorithm Dijkstra Algorithm • Net topology, link costs known to all nodes • Global algorithm • Cost of a link is a function of : • Number of Hops, Distance, Average traffic, Delay, … • Computes least cost paths (Minimum path) 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
Figure. The first five steps used in computing the shortest path from A to D. The arrows indicate the working node. Next steps? The shortest path from A to D is: ABEFHD
Example • Find the Shortest path from s to y using dijsktra algorithm for the following graph. • Solution
Dijkstra Animation • http://optlab-server.sce.carleton.ca/POAnimations2007/DijkstrasAlgo.html
Flooding Algorithm P Transmit a copy of each packet it receives on every one of its transmission links flooding P P P How to reduce looping even further: 1. hop count 2. time stamp • Using Hop Counter: • Hop count is number of nodes that a packet may have to pass through on the way to its destination. • Each router decrements a hop count contained in the packet header. • Whenever the hop count decrements to zero, the router discards the packet
Flooding • How to Keep track of which packet have been flood • Add a sequence number to each packet's header. • Each router maintains a private sequence number. When it sends a new packet, it copies the sequence number into the packet, and increments its private sequence number. • Keeps track of the highest sequence number seen from S. • Whenever it receives a packet from S containing a sequence number lower than the one stored in its table, it discards the packet. Otherwise, it updates the entry for S and forwards the packet on
Selective Flooding • Another variation of flooding is Selective Flooding: • Don’t send incoming packets to ALL output lines • Just forward on that lines which are going approximately in right direction • Flooding is not practical in most applications, but it does have some uses • Uses: • In military applications, the network must remain robust in the face of (extreme) hostility • Sending routing updates, because updates can't rely on the correctness of a router's routing table. • Theoretical-chooses all possible paths, so it chooses the shortest one
Adaptive Algorithm Distance Vector Routing • Each router • maintains a table (vector) giving the best known distance to a destination and the line to use for sending there. • Tables are updated by exchanging information with neighbors. • Each router knows the distance (cost) of reaching its neighbors (e.g. send echo requests). • Routers periodically exchange routing tables with each of their neighbors. • The distance vector routing algorithm is sometimes called by other names, most commonly Bellman-Ford routing algorithm and the Ford-Fulkerson algorithm. • This algorithm was used in the original ARPANET
Distance Vector Routing • Distance table for J DJ (G,?)= c(J,H)+minw{DH(G,w)}= 6+12=18 A subnet. Input from A, I, H, K, and the new routing table for J. Suppose that J has measured its delay to its neighbors, A, I, H, and K as 8, 10,12,6 msec respectively.
Count –to-infinity Problem • Problem: • Convergence is slow! • Good news travels quickly, bad news travels slowly (count-to-infinity) problem • Example: Propagation of good news • Initially A is down and all other routers know this • When A comes up, the other routers learn about it via the vector exchanges There is no path to A Table for dest.=A In a subnet with longest subnet path=N, after N exchanges everyone will know
Count-to-Infinity Problem • Example: Propagation of bad news • The count-to-infinity problem • A goes down after initially After this A goes down B thinks that there is a path to A thru C but C itself go to A via B! Counting will continuous to infinity
Link State Routing • Each router must do the following: Discover its neighbors, learn their network address. • Sends ‘hello' message on booting. Measure the delay or cost to each of its neighbors. • Delay= (Send ‘Echo’ message + Receive its reply)/2 Construct a packet telling all it has just learned. • Construct Link State (LS) packet, it contains: • Source Add., Seq. No., Age No., List of neighbors + their delay Send this packet to all other routers. • Forwards link state packets to all other routers using Flooding algorithm. Compute the shortest path to every other router. • Each router uses an Dijkstra algorithm to calculate shortest paths based on the current values in its database. Adaptive Algorithm
Link State Routing • Link state routing is based on the assumption that, although the global knowledge about the topology is not clear, each node has partial knowledge: it knows the state (type, condition, and cost) of its links • In other words, the whole topology can be compiled from the partial knowledge of each node
Creation of Link State Packet (LSP) • A link state packet (LSP) can carry a large amount of information such as the node identity, the list of links, a sequence number, and age • Node identity and the list of links are needed to make the topology • Sequence number facilitates flooding and distinguishes new LSPs from old ones • Age prevents old LSPs from remaining in the domain for a long time
Link State Routing The link state packets for this subnet.
Hierarchical Routing • As a network becomes larger, the amount of information that must be propagated increases, and the routing calculation becomes increasingly expensive. • (Increase the memory amount and calculation) • Hierarchical routing: • Divide the network into regions, with a router only knowing the details of how to route to other routers in its region. • Hides information from far-away nodes, reducing the amount of information a given router needs to perform routing • Router don’t know about the internal topology of other regions. • Gateway is a router that knows about other regions
Hierarchical Routing • Advantage: • Scaling. Each router needs less information • In Ex. Distance table reduce from 17 entries to 7 • Disadvantage: • Sub optimal routes. The average path length increases Optimal path for 1A to 5C is thru region 2 while in hierarchical is thru region 3
Send message to all other hosts: Update distributed database Distribute weather reports Distribute live radio/TV programs Poor methods: Send a distinct packet to each destination List of addresses needed High usage of bandwidth Flooding Too many packets Multi-destination routing Each packet contains a list of destination On each line a single packet Broadcast routing
Best method: use sink tree Broadcast source = root of sink tree Forwarding on sink tree lines Excellent use of bandwidth Source tree must be known at each intermediate node Which sink tree? How many sink trees? Broadcast routing
Broadcast routing • Sink tree approximation: reverse path forwarding if a packet arrives on line used for traffic to source of broadcast then forward packet on all lines, except the one it arrived on else discard packet
Routing Algorithms • Properties • Shortest Path Routing • Flooding • Distance Vector Routing • Link State routing • Hierarchical routing • Broadcast routing • Multicast routing • Routing for mobile hosts • Routing in Ad Hoc Networks
Send a message to a well-defined group Large in size Small compared to network as a whole Group management Create and destroy groups Process can leave and join a group algorithm Multicast routing How will routers know about groups?
Pruning: Link state routing Each router knows full topology Distance vector routing Reverse path forwarding + PRUNE messages to remove arcs Algorithm Source computes spanning tree Remove lines that do not lead to hosts of group ( = pruning) Multicast routing source
Pruning: Link state routing Each router knows full topology Distance vector routing Reverse path forwarding + PRUNE messages to remove arcs Multicast routing source
Routing Algorithms • Shortest Path Routing • Flooding • Distance Vector Routing • Link State routing • Hierarchical routing • Broadcast routing • Multicast routing • Routing for mobile hosts • Routing in Ad Hoc Networks
Move from time to time • Use network when connected • Compute on the run • Maintain connections as they move around Routing for Mobile Hosts • Model of world: WAN + LANs, wireless cells • Migratory users • Roaming users
Foreign agent: keeps track of users: who are currently visiting the area Home agent: keeps track of users whose home is in the area who are currently visiting another area Routing for Mobile Hosts Permanent home location Permanent home address
Routing for Mobile Hosts • How does it work? • Registration procedure with foreign agents • Sending packets • Leaving an area • Registration procedure with foreign agent • Announcing existence of foreign agent • Broadcast by foreign agent • Broadcast query by arriving mobile user • Mobile user gives to foreign agent • Home address • Current data link address • Security information • Foreign agent contacts home agent of user
Routing for Mobile Hosts • Registration procedure with foreign agent (cont.) • Announcing existence of foreign agent • Mobile user gives to foreign agent • Foreign agent contacts home agent of user • Identity of user • Security info • Network address of foreign agent • Home agent • Checks security info • Sends ack to foreign agent • Foreign agent • Stores state • Informs mobile user
Routing for Mobile Hosts • Sending a packet to a mobile user • Home address is used packet routed to home LAN • Packet intercepted by home agent • Packet forwarded to the foreign agent • Encapsulation – tunneling • Foreign agent forwards packet to mobile user • Sender is given address of foreign agent • Encapsulation – tunneling used
Home agent Routing for Mobile Hosts Foreign agent