Upcoming SlideShare
×

# Lecture 9 network layer

2,868 views

Published on

Published in: Education, Technology
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Informative discussion - For my two cents , if anyone was looking for a NY UD-2 , my wife came across a template document here https://goo.gl/pE8maq.

Are you sure you want to  Yes  No

### Lecture 9 network layer

1. 1. Chapter 5 The Network Layer
2. 2. Motivation
3. 3. Network Layer Design Isues • • • • • Store-and-Forward Packet Switching Services Provided to the Transport Layer Implementation of Connectionless Service Implementation of Connection-Oriented Service Comparison of Virtual-Circuit and Datagram Subnets
4. 4. Store-and-Forward Packet Switching fig 5-1 The environment of the network layer protocols.
5. 5. Implementation of Connectionless Service Routing within a diagram subnet.
6. 6. Implementation of Connection-Oriented Service Routing within a virtual-circuit subnet.
7. 7. Comparison of Virtual-Circuit and Datagram Subnets 5-4
8. 8. Types of Routing Algorithms a) Non adaptive (static) – – Do not use measurements of current conditions Static routes are downloaded at boot time a) Adaptive Algorithms – Change routes dynamically • Gather information at runtime – – – • locally from adjacent routers from all other routers Change routes – – – Every delta T seconds When load changes When topology changes
9. 9. Routing Algorithms • • • • • • • • • • The Optimality Principle 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
10. 10. Routing Algorithms (2) Conflict between fairness and optimality.
11. 11. Optimality Principle • General statement about optimal routes (topology, routing algorithm independent). • If router J is on optimal path between I and K, then the optimal path from J to K also falls along the same route. • Corollary: – Set of optimal routes from all sources to destination form a tree rooted at destination. – Sink tree.
12. 12. The Optimality Principle (a) A subnet. (b) A sink tree for router B.
13. 13. Shortest Path Routing The first 5 steps used in computing the shortest path from A to D. The arrows indicate the working node.
14. 14. Flooding • Every incoming packet forwarded on every outgoing link except the one it arrived on. • Problem: duplicates. • Constraining the flood: – Hop count. – Keep track of packets that have been flooded. • Robust, shortest delay (picks shortest path as one of the paths).
15. 15. Flooding Example
16. 16. Flooding (a nonadaptive routing algorithm) a) Brute force routing – – – – Every incoming packet is sent on every outgoing line Always finds the shortest path quickly Also finds many long paths Time to live is set to size of subnet a) Selective Flooding – Flood only in the direction of the destination a) Practical in a few settings – – – Military Applications Distributed Databases Metric for comparison
17. 17. Dynamic Routing Algorithm a) b) Distance vector routing. Link state routing. 1. 2. 3. Dynamic algorithm reacts based on current situation of network. It involves sharing of information. Global sharing Vs. Local sharing.
18. 18. Problem - Internet
19. 19. Distance Vector Routing - Concept
20. 20. Distance Vector Routing - Table
21. 21. DVR – Table Distribution
22. 22. Updating Routing Table - A
23. 23. Final Routing Table
24. 24. Ex - Distance Vector Routing (a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.
25. 25. Update Mechanism a) b) c) d) Periodic Updates: Updates to the routing tables are sent at the end of a certain time period. A typical value is 90 seconds. Triggered Updates: If a metric changes on a link, a router immediately sends out an update without waiting for the end of the update period. Full Routing Table Update: Most distance vector routing protocol send their neighbors the entire routing table (not only entries which change). Route invalidation timers: Routing table entries are invalid if they are not refreshed. A typical value is to invalidate an entry if no update is received after 3-6 update periods.
26. 26. Problem – Count to Infinity A A 1 1 B B A's Routing Table B's Routing Table via to cost (next hop) C C C B via to 2 (next hop) cost C C 1 C - oo A 3 - oo now link B-C goes down C B 2 C C - 2 oo C C C B C oo C 4 C oo 3 C 4 C oo
27. 27. Count to Infinity a) b) c) The reason for the count-to-infinity problem is that each node only has a “next-hop-view” For example, in the first step, A did not realize that its route (with cost 2) to C went through node B How can the Count-to-Infinity problem be solved?
28. 28. Solution a) Solution 1: Always advertise the entire path in an update message (Path vectors) If routing tables are large, the routing messages require substantial bandwidth . BGP uses this solution b) Solution 2: Never advertise the cost to a neighbor if this neighbor is the next hop on the current path (Split Horizon) – – Example: A would not send the first routing update to B, since B is the next hop on A’s current route to C Split Horizon does not solve count-to-infinity in all cases!
29. 29. Link State Routing - Concept
30. 30. Link State Routing Each router must do the following: 1. Discover its neighbors, learn their network address. 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.
31. 31. Learning about the Neighbors  A router knows its network interfaces just sends a HELLO packet on each point-to-point link, and the router at the other end must reply telling who it is with its unique network address (a) Nine routers and a LAN. (b) A graph model of (a).
32. 32. Measuring Line Cost • Simple, send an ECHO packet to the neighbor, measure the roundtrip delay and divide it by two, and this will give a reasonable estimate of the actual delay
33. 33. Building Link State Packets (a) A subnet. (b) The link state packets for this subnet.
34. 34. Distributing the Link State Packets • Each router maintains list of (source, seq.number) pairs they saw. When a LSP arrives, it is checked against the list. • If it is new, it is forwarded on all lines except the one it arrived on; if it is a duplicate, it is discarded. • To safeguard against old data, link down etc., age is decremented once a second and every time it is forwarded by a router. When the age reaches zero, the LSP is discarded The packet buffer for router B in the previous slide (Fig. 5-13).
35. 35. Hierarchical Routing Hierarchical routing.
36. 36. Broadcast Routing a) b) c) d) Sending a packet to every destinations simultaneously is called broadcasting, and various ways are: Send an individual packet addressed to each destination, not really a good idea Use flooding, provided that the flood can effectively be kept in check Build a sink tree rooted at source, and use it in routing (This sink tree is also a spanning tree, as every nodes are on it) If this can be done, it is great but if not, how to do it approximately?
37. 37. Million Dollar Question a) What is the difference between flooding & broadcasting ? Flooding refers  to  the  specific  multiplicative  process  of delivering the PDU.  Broadcasting/multicasting refers  to  the  of originating these PDUs by their sender. process
38. 38. Broadcast Routing Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding.
39. 39. Reverse Path Forwarding a) b) c) Assume normally when router A forwards packet to router B, it uses outgoing link that lies on sink tree rooted at B. This algorithm is remarkably simple: When a broadcast packet arrives, router checks to see if the packet arrived on the line that is normally used for sending packets to the source of broadcast. If so, there is an excellent chance that the best route was used and this is the first copy to arrive at the router. The router then forwards the packet onto all lines except the one it arrived on. If, however, the broadcast packet arrived on a line other than the preferred one for reaching the source, the packet is discarded as a likely duplicate
40. 40. a) b) c) d) e) f) g) For comparison (b) has source router I at the root of a sink tree. All routers would normally send packets to the source router along the sink tree using the optimal path (e.g. I-B would follow I-F-D-C-B). Using reverse path forwarding the path may differ from the sink tree, on receiving a broadcast packet from the source router on the usual channel, each router would forward packet on all channels except the one received under the assumption the receiving channel was optimal. In this case was simply the reverse of the sink tree path normally used for sending to the packet source. In diagram (c) H sends a packet to K but K expects to receive packets from M so the packet is discarded rather than forwarded. The optimal case using the sink tree requires a maximum of 4 hops maximum (I-N-M-K-L) and 14 total packets. Using reverse path forwarding requires a maximum of 5 hops (4 for I-NM-K-L plus 1 to B) and 23 total packets with the extra, duplicate packets sent to the leaf nodes.
41. 41. Multicast Routing (a) A network. (b) A spanning tree for the leftmost router. (c) A multicast tree for group 1. (d) A multicast tree for group 2.
42. 42. Routing for Mobile Hosts A WAN to which LANs, MANs, and wireless cells are attached.
43. 43. Routing for Mobile Hosts (2) Packet routing for mobile users.
44. 44. Routing in Ad Hoc Networks Possibilities when the routers are mobile: 1. Military vehicles on battlefield. – No infrastructure. 1. A fleet of ships at sea. – All moving all the time 1. Emergency works at earthquake . – The infrastructure destroyed. 1. A gathering of people with notebook computers. – In an area lacking 802.11.
45. 45. Route Discovery 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.
46. 46. Flow Vs. Congestion Control Flow control: a network with a capacity of 1000 gigabits/sec on which a supercomputer is trying to transfer a file to a personal computer at 1Gbps. Although there is no congestion (the network itself is not in trouble), flow control is needed to force the supercomputer to stop frequently to give the personal computer a chance to breathe. Congestion Control: At the other extreme, consider a store-and-forward network with 1-Mbps lines and 1000 large computers, half of which are trying to transfer files at 100 kbps to the other half. Here the problem is not that of fast senders overpowering slow receivers, but simply that the total offered traffic exceeds what the network can handle.
47. 47. Congestion Control a) b) When one part of the subnet (e.g. one or more routers in an area) becomes overloaded, congestion results. Because routers are receiving packets faster than they can forward them, one of two things must happen: – – a) The subnet must prevent additional packets from entering the congested region until those already present can be processed. The congested routers can discard queued packets to make room for those that are arriving. Busty Traffic, Slow Processor, Insufficient Memory, Less Bandwidth
48. 48. Congestion Control Algorithms • • • • • • General Principles of Congestion Control Congestion Prevention Policies Congestion Control in Virtual-Circuit Subnets Congestion Control in Datagram Subnets Load Shedding Jitter Control
49. 49. Congestion When too much traffic is offered, congestion sets in and performance degrades sharply.
50. 50. General Principles of Congestion Control 1. Monitor the system . – detect when and where congestion occurs. 1. Pass information to where action can be taken. 2. Adjust system operation to correct the problem.
51. 51. Congestion Prevention Policies 5-26 Policies that affect congestion.
52. 52. Solution a) Congestion Control is concerned with efficiently using a network at high load. b) Several techniques can be employed. These include: – Warning bit – Choke packets – Load shedding – Random early discard – Traffic shaping a) The first 3 deal with congestion detection and recovery. The last 2 deal with congestion avoidance.
53. 53. Warning Bit a) A special bit in the packet header is set by the router to warn the source when congestion is detected. b) The bit is copied and piggy-backed on the ACK and sent to the sender. c) The sender monitors the number of ACK packets it receives with the warning bit set and adjusts its transmission rate accordingly. 54
54. 54. Choke Packets a) A more direct way of telling the source to slow down. b) A choke packet is a control packet generated at a congested node and transmitted to restrict traffic flow. c) The source, on receiving the choke packet must reduce its transmission rate by a certain percentage. d) An example of a choke packet is the ICMP Source Quench Packet.
55. 55. Hop-by-Hop Choke Packets (a) A choke packet that affects only the source. (b) A choke packet that affects each hop it passes through.
56. 56. Hop-by-Hop Choke Packets a) Over long distances or at high speeds choke packets are not very effective. b) A more efficient method is to send to choke packets hopby-hop. c) This requires each hop to reduce its transmission even before the choke packet arrive at the source. 57
57. 57. Load Shedding a) When buffers become full, routers simply discard packets. b) Which packet is chosen to be the victim depends on the application and on the error strategy used in the data link layer. c) For a file transfer, for, e.g. cannot discard older packets since this will cause a gap in the received data. d) For real-time voice or video it is probably better to throw away old data and keep new packets. e) Get the application to mark packets with discard priority.
58. 58. Random Early Discard (RED) a) b) c) d) e) This is a proactive approach in which the router discards one or more packets before the buffer becomes completely full. Each time a packet arrives, the RED algorithm computes the average queue length, avg. If avg is lower than some lower threshold, congestion is assumed to be minimal or non-existent and the packet is queued. If avg is greater than some upper threshold, congestion is assumed to be serious and the packet is discarded. If avg is between the two thresholds, this might indicate the onset of congestion. The probability of congestion is then calculated.
59. 59. Congestion Control in Virtual-Circuit Subnets (a) A congested subnet. (b) A redrawn subnet, eliminates congestion and a virtual circuit from A to B.
60. 60. Jitter Control (a) High jitter. (b) Low jitter.
61. 61. The IP Protocol The IPv4 (Internet Protocol) header.
62. 62. The IP Protocol (2) 5-54 Some of the IP options.
65. 65. Subnets A campus network consisting of LANs for various departments.
66. 66. Subnets (2) A class B network subnetted into 64 subnets.
67. 67. Review – Subnetting a) b) A network on the Internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts it can handle? A network on the Internet has a subnet mask of 255.255.224.0. What is the maximum number of hosts it can handle?
68. 68. Complex Problem a) b) c) A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order. For each of these, give: – – – the first IP address assigned the last IP address assigned the mask in the w.x.y.z/s notation.
69. 69. Solution a) b) • • • • All the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows: A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20 B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21 C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20 D: 198.16.64.0 – 198.16.96.255 written as 198.16.64.0/19
70. 70. Explanation 198.16.16.0 Total no. of Ov e I c r he an re us not be e 1 ca – 198.16.23.255 written as 198.16.16.0/21 of use so A l host weutrequire 2000 that means 2000 / 256 ion = 8 block 198.16.00010 _3 bit host part_ . 8 bit host part (Total 11 Bit) (256) 00010001. (256) 00010010. (256) 00010011. (256) 00010100. (256) 00010101. (256) 00010110. (256) 00010111. (256) 16 + 4 +2 +1 = 23
71. 71. Addresses with and without Subnetting
73. 73. Quality of Service • • • • • Requirements Techniques for Achieving Good Quality of Service Integrated Services Differentiated Services Label Switching and MPLS
74. 74. Requirements 5-30 How stringent the quality-of-service requirements are.
75. 75. Buffering Smoothing the output stream by buffering packets.
76. 76. The Leaky Bucket Algorithm (a) A leaky bucket with water. (b) a leaky bucket with packets.
77. 77. The Token Bucket Algorithm 5-34 (a) Before. (b) After.
78. 78. The Leaky Bucket Algorithm (a) Input to a leaky bucket. (b) Output from a leaky bucket. Output from a token 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 bucket.
79. 79. Token Bucket Example a) Consider a token bucket with token arrival rate of ρ bytes/sec and a token credit capacity of W bytes. The data rate is M bytes/sec. Let S be the duration of the maximum output burst rate from the full token-bucket. (a) Carefully derive an expression for S. (b) What is S if ρ = 16 Mbps and W = 500 KB and if a burst arrives over a channel with data rate 200 Mbps and lasts 40 msec? a) Total amount of data in burst = MS. This corresponds to not only the token capacity of the bucket, W, but the extra tokens that arrive during the burst, ρS. Thus: W + ρS = MS, and hence S = W/(M - ρ). c) S = 500x1024/(25x106 - 2x106 ) = 22.3 msec. There is a 25 MB/s output burst of 22.3 msec after the onset of the incoming burst of data.
80. 80. Admission Control 5-34 An example of flow specification.
81. 81. Packet Scheduling (a) A router with five packets queued for line O. (b) Finishing times for the five packets.
82. 82. RSVP-The ReSerVation Protocol (a) A network, (b) The multicast spanning tree for host 1. (c) The multicast spanning tree for host 2.
83. 83. RSVP-The ReSerVation Protocol (2) (a) Host 3 requests a channel to host 1. (b) Host 3 then requests a second channel, to host 2. (c) Host 5 requests a channel to host 1.
84. 84. Expedited Forwarding Expedited packets experience a traffic-free network.
85. 85. Assured Forwarding A possible implementation of the data flow for assured forwarding.
86. 86. Label Switching and MPLS Transmitting a TCP segment using IP, MPLS, and PPP.
87. 87. Internetworking • • • • • • • How Networks Differ How Networks Can Be Connected Concatenated Virtual Circuits Connectionless Internetworking Tunneling Internetwork Routing Fragmentation
88. 88. How Networks Differ 5-43 Some of the many ways networks can differ.
89. 89. How Networks Can Be Connected (a) Two Ethernets connected by a switch. (b) Two Ethernets connected by routers.
90. 90. Concatenated Virtual Circuits Internetworking using concatenated virtual circuits.
91. 91. Connectionless Internetworking A connectionless internet.
92. 92. Tunneling Tunneling a packet from Paris to London.
93. 93. Fragmentation (a) Transparent fragmentation. (b) Nontransparent fragmentation.
94. 94. Fragmentation (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. (c) Fragments after passing through a size 5 gateway.
95. 95. The Network Layer in the Internet • • • • • • • The IP Protocol IP Addresses Internet Control Protocols OSPF – The Interior Gateway Routing Protocol BGP – The Exterior Gateway Routing Protocol Mobile IP IPv6
96. 96. Internet Control Message Protocol 5-61 The principal ICMP message types.