Chapter 5 Network Layer Network Layer l Functions

  • Slides: 61
Download presentation
Chapter 5 Network Layer

Chapter 5 Network Layer

Network Layer l Functions: q Routing issues application transport network data link physical Ø

Network Layer l Functions: q Routing issues application transport network data link physical Ø determine “good” path (sequence of routers) thru network from source to dest. q Congestion (Not Contention!) Ø More packets enter an area than can be processed network data link physical connecting different network technologies together l network data link physical q Internetworking Ø network data link physical Network layer protocols in every host, router application transport network data link physical

Network Layer Design Issues • • • Store-and-forward packet switching Services provided to transport

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 l Store-and-Forward packet switching q. After each reception checksum is

Network layer design issues l Store-and-Forward packet switching q. After each reception checksum is done in router and a new packet is transmitted to the next router. 1

Network layer design issues l Services provided to transport layer q. Independent of subnet

Network layer design issues l Services provided to transport layer q. Independent of subnet technology q. Transport layer shielded from number, type, and topology of subnets q. Uniform network address numbering Ø Even across LANs and WANs

Network layer design issues l Two basic kind of services q. Connectionless (routers only

Network layer design issues l Two basic kind of services q. Connectionless (routers only send and receive packets) ØPackets also called datagram ØThis kind of network is also called datagram subnet q. 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

Connectionless: Datagram l l No call setup at network layer Packets forwarded using destination

Connectionless: Datagram l l No call setup at network layer Packets forwarded using destination host address q packets between same source-dest. pair may take different paths l Use in Internet application 2. Receive Data transport network data link physical application transport network data link physical 1. Send Data

Connectionless: Datagram l Routing within a diagram subnet: Subnet Routing tables Store-and-Forward packet The

Connectionless: Datagram l Routing within a diagram subnet: Subnet Routing tables Store-and-Forward packet The table of router A is changed because of some reasons! Management and update this tables for routing = Routing algorithm

Connection Oriented-Virtual Circuits l l l Call setup, do for each call before data

Connection Oriented-Virtual Circuits l l l Call setup, do for each call before data can flow Each packet carries VC identifier Used in ATM, frame-relay, X. 25 6. Receive data application 3. Accept calltransport 2. Incoming call network 5. Data flow begins 4. Call connected application 1. Initiate call transport network data link physical

Virtual Circuits l Routing within a virtual-circuit subnet:

Virtual Circuits l Routing within a virtual-circuit subnet:

Comparison of Virtual-Circuit and Datagram Subnets

Comparison of Virtual-Circuit and Datagram Subnets

Routing Algorithms l l The network layer is responsible for routing packets from the

Routing Algorithms l l 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: q Correctness, simplicity, stability, fairness and optimality q Minimizing mean packet delay or maximizing total network throughput l Routing is different from Forwarding!: q Forwarding: Select the output path using routing table q Routing: Management and updating the routing tables

Desirable properties of the routing algorithms: q. Correctness: q. Simplicity: for efficiency q. Robustness:

Desirable properties of the routing algorithms: q. Correctness: q. Simplicity: for efficiency q. Robustness: must be able to sustain the changes in the networks (cannot just rely on reboot) q. Stability: should converge to equilibrium q. Fairness: every one gets to send q. Optimality: (Selection of Best Route)as efficient as possible

Routing Algorithms Conflict between fairness and optimality. If traffic flows between A and A’,

Routing Algorithms Conflict between fairness and optimality. If traffic flows between A and A’, B and B’, 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 l Optimality principle: q. If router J is on the optimal path

Optimality Principle l Optimality principle: q. 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. l This means: q. 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. q. The goal of all routing algorithms is to discover and use the sink tree for all routers. q. Since it is a tree, there is no loops. q. There would be different sink trees for each final destination.

The Optimality Principle (a) A subnet. (b) A sink tree for router B.

The Optimality Principle (a) A subnet. (b) A sink tree for router B.

Routing l There are two types: q Static (Non-Adaptive) Ø routes never update or

Routing l There are two types: q Static (Non-Adaptive) Ø routes never update or update slowly over time Ø Examples: Dijkstra, Flooding algorithm q Dynamic (Adaptive) Øroutes update more quickly use dynamic information of current topology such as load, delay, … Ø Examples: Distance Vector, Link State Routing l From another view: q Global: all routers have complete topology, link cost info q Decentralized: router knows physically-connected neighbors

Routing Algorithms l l l l l Shortest Path Routing (Dijkstra’s) Flooding Distance Vector

Routing Algorithms l l l l l 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 l Net topology, link costs known to all nodes q.

Non-Adaptive Algorithm Dijkstra Algorithm l Net topology, link costs known to all nodes q. Global algorithm q Cost of a link is a function of : Ø Number of Hops, Hop Distance, Average traffic, Delay, … l Computes least cost paths (Minimum path) from one node (‘source”) to all other nodes q gives routing table for that node l Iterative: after k iterations, know least cost path to k dest. ’s

Next steps? • Figure. The first five steps used in computing the shortest path

Next steps? • Figure. The first five steps used in computing the shortest path from A to D. The arrows indicate the working node. The shortest path from A to D is: ABEFHD

l l l Example Find the Shortest path from s to y using dijsktra

l l l Example Find the Shortest path from s to y using dijsktra algorithm for the following graph. Solution

Dijkstra Animation l http: //optlab-server. sce. carleton. ca/POAnimations 2007/Dijkstras. Algo. html

Dijkstra Animation l http: //optlab-server. sce. carleton. ca/POAnimations 2007/Dijkstras. Algo. html

Flooding Algorithm P flooding P P P Transmit a copy of each packet it

Flooding Algorithm P flooding P P P Transmit a copy of each packet it receives on every one of its transmission links How to reduce looping even further: 1. hop count 2. time stamp Using Hop Counter: q. Hop count is number of nodes that a packet may have to pass through on the way to its destination. q. Each router decrements a hop count contained in the packet header. q. Whenever the hop count decrements to zero, the router discards the packet

Flooding q. How to Keep track of which packet have been flood ØAdd a

Flooding q. 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 l Another variation of flooding is Selective Flooding: q Don’t send incoming

Selective Flooding l Another variation of flooding is Selective Flooding: q Don’t send incoming packets to ALL output lines q Just forward on that lines which are going approximately in right direction q Flooding is not practical in most applications, but it does have some uses l Uses: q In military applications, the network must remain robust in the face of (extreme) hostility q Sending routing updates, because updates can't rely on the correctness of a router's routing table. q Theoretical-chooses all possible paths, so it chooses the shortest one

Adaptive Algorithm Distance Vector Routing l Each router q maintains a table (vector) giving

Adaptive Algorithm Distance Vector Routing l Each router q maintains a table (vector) giving the best known distance to a destination and the line to use for sending there. q Tables are updated by exchanging information with neighbors. q Each router knows the distance (cost) of reaching its neighbors (e. g. send echo requests). l l l 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 l Distance table for J DJ (G, ? )= c(J, H)+minw{DH(G,

Distance Vector Routing l Distance table for J DJ (G, ? )= c(J, H)+minw{DH(G, w)}= 6+12=18 (a) (b) 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 l Problem: q Convergence is slow! q Good news travels quickly,

Count –to-infinity Problem l Problem: q Convergence is slow! q Good news travels quickly, bad news travels slowly (countto-infinity) problem l Example: Propagation of good news q Initially A is down and all other routers know this q 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 l Example: Propagation of bad news q The count-to-infinity problem q A

Count-to-Infinity Problem l Example: Propagation of bad news q The count-to-infinity problem q 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 l Each router must do the following: Discover its neighbors, learn

Link State Routing l Each router must do the following: Discover its neighbors, learn their network address. Ø Sends ‘hello' message on booting. Adaptive Algorithm 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.

Link State Routing l l Link state routing is based on the assumption that,

Link State Routing l l 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) l A link state packet (LSP) can carry

Creation of Link State Packet (LSP) l 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 q. Node identity and the list of links are needed to make the topology q. Sequence number facilitates flooding and distinguishes new LSPs from old ones q. Age prevents old LSPs from remaining in the domain for a long time

Link State Routing The link state packets for this subnet.

Link State Routing The link state packets for this subnet.

Hierarchical Routing l l l As a network becomes larger, the amount of information

Hierarchical Routing l l l 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: q Divide the network into regions, with a router only knowing the details of how to route to other routers in its region. q 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 l Advantage: q Scaling. Each router needs less information Ø In Ex.

Hierarchical Routing l Advantage: q Scaling. Each router needs less information Ø In Ex. Distance table reduce from 17 entries to 7 l Disadvantage: q Sub optimal routes. The average path length increases Optimal path for 1 A to 5 C is thru region 2 while in hierarchical is thru region 3

Broadcast routing l Send message to all other hosts: q Update distributed database q

Broadcast routing l Send message to all other hosts: q Update distributed database q Distribute weather reports q Distribute live radio/TV programs l Poor methods: q Send a distinct packet to each destination Ø List of addresses needed Ø High usage of bandwidth q Flooding Ø Too many packets q Multi-destination routing Ø Each packet contains a list of destination Ø On each line a single packet

Broadcast routing l Best method: use sink tree o o Broadcast source = root

Broadcast routing l Best method: use sink tree o o 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 l Sink tree approximation: reverse path forwarding if a packet arrives on

Broadcast routing l 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 l l l l l Properties Shortest Path Routing Flooding Distance Vector

Routing Algorithms l l l l l 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

Multicast routing l Send a message to a well-defined group q Large in size

Multicast routing l Send a message to a well-defined group q Large in size q Small compared to network as a whole l How will routers know about groups? Group management q Create and destroy groups q Process can leave and join a group l algorithm

Multicast routing source l Algorithm q Source computes spanning tree q Remove lines that

Multicast routing source l Algorithm q Source computes spanning tree q Remove lines that do not lead to hosts of group ( = pruning) l Pruning: q Link state routing Ø Each router knows full topology q Distance vector routing Ø Reverse path forwarding + Ø PRUNE messages to remove arcs

Multicast routing source l Pruning: q Link state routing Ø Each router knows full

Multicast routing source l Pruning: q Link state routing Ø Each router knows full topology q Distance vector routing Ø Reverse path forwarding + Ø PRUNE messages to remove arcs

Routing Algorithms l l l l l Shortest Path Routing Flooding Distance Vector Routing

Routing Algorithms l l l l l 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

Routing for Mobile Hosts l Model of world: WAN + LANs, wireless cells l

Routing for Mobile Hosts l Model of world: WAN + LANs, wireless cells l Migratory users o Move from time to time l Roaming users o Use network when connected o Compute on the run o Maintain connections as they move around

Routing for Mobile Hosts l Foreign agent: keeps track of users: q who are

Routing for Mobile Hosts l Foreign agent: keeps track of users: q who are currently visiting the area l Home agent: keeps track of users q whose home is in the area q who are currently visiting another area Permanent home location Permanent home address

Routing for Mobile Hosts l How does it work? q Registration procedure with foreign

Routing for Mobile Hosts l How does it work? q Registration procedure with foreign agents q Sending packets q Leaving an area l Registration procedure with foreign agent q Announcing existence of foreign agent Ø Broadcast by foreign agent Ø Broadcast query by arriving mobile user q Mobile user gives to foreign agent Ø Home address Ø Current data link address Ø Security information q Foreign agent contacts home agent of user

Routing for Mobile Hosts l Registration procedure with foreign agent (cont. ) q. Announcing

Routing for Mobile Hosts l Registration procedure with foreign agent (cont. ) q. Announcing existence of foreign agent q. Mobile user gives to foreign agent q. Foreign agent contacts home agent of user ØIdentity of user ØSecurity info ØNetwork address of foreign agent q. Home agent ØChecks security info ØSends ack to foreign agent q. Foreign agent ØStores state ØInforms mobile user

Routing for Mobile Hosts l Sending a packet to a mobile user q. Home

Routing for Mobile Hosts l Sending a packet to a mobile user q. Home address is used packet routed to home LAN q. Packet intercepted by home agent q. Packet forwarded to the foreign agent ØEncapsulation – tunneling q. Foreign agent forwards packet to mobile user q. Sender is given address of foreign agent ØEncapsulation – tunneling used

Routing for Mobile Hosts Home agent Foreign agent

Routing for Mobile Hosts Home agent Foreign agent

Routing for Mobile Hosts l l Leaving an area q. Announced by user deregistration

Routing for Mobile Hosts l l Leaving an area q. Announced by user deregistration q. Automatic detection by foreign agent Various different schemes: q. Protocol carried out by routers or hosts q. Routers along the way intercept and redirect traffic q. Modify original packet instead of encapsulation

Routing Algorithms l l l l l Properties Shortest Path Routing Flooding Distance Vector

Routing Algorithms l l l l l 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

Routing in Ad Hoc Networks l Networks of nodes that just happen to be

Routing in Ad Hoc Networks l Networks of nodes that just happen to be near each other are called ad hoc networks or MANETs (Mobile Ad hoc NETworks). l Ad Hoc Network = routers are mobile q No fixed topologies q No fixed or known neighbors q Valid paths can disappear at any time q Node = router + host q Routing quite different from routing in wired networks l Examples q Military vehicles on a battlefield q Fleet of ships at see q People with notebooks (lacking 802. 11) l AODV = Ad hoc On-demand distance vector routing q On-demand: route computed when needed q Distance vector for mobile world q Taking into account limited bandwidth + low battery life

Routing in Ad Hoc Networks l Graph presentation q Node q Arc = nodes

Routing in Ad Hoc Networks l Graph presentation q Node q Arc = nodes connected can communicate directly by radio l Routing table: q Line for known routes q Can be valid or invalid l A wants to send a packet q To H: forward to D q To I: start route discovery broadcasting a route request packet

Routing in Ad Hoc Networks (a) Range of A's broadcast. o (b) After B

Routing in Ad Hoc Networks (a) Range of A's broadcast. o (b) After B and D have received A's broadcast. o (c) After C, F, and G have received A's broadcast. o (d) After E, H, and I have received A's broadcast. Shaded nodes are new recipients. Arrows show possible reverse routes. o

Routing in Ad Hoc Networks l Route request packet: Source & destination address: e.

Routing in Ad Hoc Networks l Route request packet: Source & destination address: e. g. IP address Request ID: • local counter incremented for each new route request packet broadcasted • allows to discard duplicate requests at other nodes Source sequence # • counter to distinguish old routes to destination from new ones Destination sequence # • most recent sequence counter of destination seen by source

Routing in Ad Hoc Networks l Processing a route request packet qduplicate request? ØYes:

Routing in Ad Hoc Networks l Processing a route request packet qduplicate request? ØYes: discard q. Fresh route to destination known? ØFresh = local destination sequence # >= destination sequence # in request ØYes: send route reply packet q. No fresh route to destination is known! Ø Store info from route request in reverse route table; to enable the forwarding of route reply packets Ø Increment hop count Ø Rebroadcast route request

Routing in Ad Hoc Networks l Route reply packet q. Returned by ØIntermediate node

Routing in Ad Hoc Networks l Route reply packet q. Returned by ØIntermediate node knowing a fresh route ØDestination node Destination sequence# q Number known by sender of reply packet Hop count q Set to length of path known by sender of reply packet q For destination = 0

Routing in Ad Hoc Networks l Route maintenance q. Detect that neighbors are not

Routing in Ad Hoc Networks l Route maintenance q. Detect that neighbors are not reachable anymore ØBroadcast Hello packet periodically ØFailure to send packet q. Cleanup routing table q. Additional field in routing table: active neighbor ØNodes that have offered path to destination in recent past

Routing in Ad Hoc Networks l Route maintenance G q. Routing table of D

Routing in Ad Hoc Networks l Route maintenance G q. Routing table of D Node G goes down!

Routing in Ad Hoc Networks l Route maintenance q. New routing table of D:

Routing in Ad Hoc Networks l Route maintenance q. New routing table of D: ØDelete routes with G as next hop ØDelete G as active neigbor