The Network Layer Chapter 5
The Network Layer
Chapter 5
Motivation
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
Store-and-Forward Packet Switching
The environment of the network layer protocols.
fig 5-1
Implementation of Connectionless Service
Routing within a diagram subnet.
Implementation of Connection-Oriented Service
Routing within a virtual-circuit subnet.
Comparison of Virtual-Circuit and Datagram Subnets
5-4
Types of Routing Algorithms
a) Non adaptive (static)– Do not use measurements of current conditions
– Static routes are downloaded at boot time
b) 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
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
Routing Algorithms (2)
Conflict between fairness and optimality.
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.
The Optimality Principle
(a) A subnet. (b) A sink tree for router B.
Shortest Path Routing
The first 5 steps used in computing the shortest path from A to D. The arrows indicate the working node.
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).
Flooding Example
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
b) Selective Flooding– Flood only in the direction of the destination
c) Practical in a few settings– Military Applications
– Distributed Databases
– Metric for comparison
Flooding (a nonadaptive routing algorithm)
Dynamic Routing Algorithm
a) Distance vector routing.
b) Link state routing.
1. Dynamic algorithm reacts based on current situation of network.
2. It involves sharing of information.
3. Global sharing Vs. Local sharing.
Problem - Internet
Distance Vector Routing - Concept
Distance Vector Routing - Table
DVR – Table Distribution
Updating Routing Table - A
Final Routing Table
Ex - Distance Vector Routing
(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.
Update Mechanism
a) Periodic Updates: Updates to the routing tables are sent at the end of a certain time period. A typical value is 90 seconds.
b) 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.
c) Full Routing Table Update: Most distance vector routing protocol send their neighbors the entire routing table (not only entries which change).
d) 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.
Problem – Count to Infinity
A's Routing Table B's Routing Table
C
to costvia(next hop)
2B C
to costvia(next hop)
1C
now link B-C goes down
C 2 C oo
C oo-C 2B
C oo C 3
C 3AC oo-
C 4 C oo
C oo-C 4B
AA BB CC1 1
Count to Infinity
a) The reason for the count-to-infinity problem is that each node only has a “next-hop-view”
b) For example, in the first step, A did not realize that its route (with cost 2) to C went through node B
c) How can the Count-to-Infinity problem be solved?
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!
Link State Routing - Concept
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.
Learning about the Neighbors
(a) Nine routers and a LAN. (b) A graph model of (a).
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
Measuring Line Cost
• Simple, send an ECHO packet to the neighbor, measure the round-trip delay and divide it by two, and this will give a reasonable estimate of the actual delay
Building Link State Packets
(a) A subnet. (b) The link state packets for this subnet.
Distributing the Link State Packets
The packet buffer for router B in the previous slide (Fig. 5-13).
• 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
Hierarchical Routing
Hierarchical routing.
Broadcast Routing
a) Sending a packet to every destinations simultaneously is called broadcasting, and various ways are:
b) Send an individual packet addressed to each destination, not really a good idea
c) Use flooding, provided that the flood can effectively be kept in check
d) 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?
Million Dollar Questiona) What is the difference between flooding & broadcasting ?
Flooding refers to the specific multiplicative process of delivering the PDU.
Broadcasting/multicasting refers to the process of originating these PDUs by their sender.
Broadcast Routing
Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding.
Reverse Path Forwarding
a) 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:
b) 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.
c) 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
a) For comparison (b) has source router I at the root of a sink tree.
b) 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).
c) 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.
d) In this case was simply the reverse of the sink tree path normally used for sending to the packet source.
e) 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.
f) The optimal case using the sink tree requires a maximum of 4 hops maximum (I-N-M-K-L) and 14 total packets.
g) Using reverse path forwarding requires a maximum of 5 hops (4 for I-N-M-K-L plus 1 to B) and 23 total packets with the extra, duplicate packets sent to the leaf nodes.
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.
Routing for Mobile Hosts
A WAN to which LANs, MANs, and wireless cells are attached.
Routing for Mobile Hosts (2)
Packet routing for mobile users.
Routing in Ad Hoc Networks
Possibilities when the routers are mobile:
1. Military vehicles on battlefield.– No infrastructure.
2. A fleet of ships at sea.– All moving all the time
3. Emergency works at earthquake .– The infrastructure destroyed.
4. A gathering of people with notebook computers.– In an area lacking 802.11.
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.
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.
Congestion Control
a) When one part of the subnet (e.g. one or more routers in an area) becomes overloaded, congestion results.
b) Because routers are receiving packets faster than they can forward them, one of two things must happen:
– 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.
c) Busty Traffic, Slow Processor, Insufficient Memory, Less Bandwidth
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
Congestion
When too much traffic is offered, congestion sets in and performance degrades sharply.
General Principles of Congestion Control
1. Monitor the system .
– detect when and where congestion occurs.
2. Pass information to where action can be taken.
3. Adjust system operation to correct the problem.
Congestion Prevention Policies
Policies that affect congestion.
5-26
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
c) The first 3 deal with congestion detection and recovery. The last 2 deal with congestion avoidance.
54
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.
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.
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.
57
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 hop-by-hop.
c) This requires each hop to reduce its transmission even before the choke packet arrive at the source.
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.
Random Early Discard (RED)
a) This is a proactive approach in which the router discards one or more packets before the buffer becomes completely full.
b) Each time a packet arrives, the RED algorithm computes the average queue length, avg.
c) If avg is lower than some lower threshold, congestion is assumed to be minimal or non-existent and the packet is queued.
d) If avg is greater than some upper threshold, congestion is assumed to be serious and the packet is discarded.
e) If avg is between the two thresholds, this might indicate the onset of congestion. The probability of congestion is then calculated.
Congestion Control in Virtual-Circuit Subnets
(a) A congested subnet. (b) A redrawn subnet, eliminates congestion and a virtual circuit from A to B.
Jitter Control
(a) High jitter. (b) Low jitter.
The IP Protocol
The IPv4 (Internet Protocol) header.
The IP Protocol (2)
Some of the IP options.
5-54
IP Addresses
IP address formats.
IP Addresses (2)
Special IP addresses.
Subnets
A campus network consisting of LANs for various departments.
Subnets (2)
A class B network subnetted into 64 subnets.
Review – Subnettinga) A network on the Internet has a subnet mask of 255.255.240.0.
What is the maximum number of hosts it can handle?
b) A network on the Internet has a subnet mask of 255.255.224.0. What is the maximum number of hosts it can handle?
Complex Problem
a) A large number of consecutive IP address are available starting at 198.16.0.0.
b) Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order.
c) 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.
Solutiona) All the requests are rounded up to a power of two.
b) 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
Explanation198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21
Total no. of host we require 2000 that means 2000 / 256 = 8 block
198.16.00010 _3 bit host part_ . 8 bit host part (Total 11 Bit) (256)
Over here I can not use 1
because of A solution
00010001. (256)
00010010. (256)
00010011. (256)
00010100. (256)
00010101. (256)
00010110. (256)
00010111. (256)
16 + 4 +2 +1 = 23
Addresses with and without Subnetting
Masking
Quality of Service
• Requirements• Techniques for Achieving Good Quality of Service• Integrated Services• Differentiated Services• Label Switching and MPLS
Requirements
How stringent the quality-of-service requirements are.
5-30
Buffering
Smoothing the output stream by buffering packets.
The Leaky Bucket Algorithm
(a) A leaky bucket with water. (b) a leaky bucket with packets.
The Token Bucket Algorithm
(a) Before. (b) After.
5-34
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.
Token Bucket Examplea) 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?
b) 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.
Admission Control
An example of flow specification.
5-34
Packet Scheduling
(a) A router with five packets queued for line O.(b) Finishing times for the five packets.
RSVP-The ReSerVation Protocol
(a) A network, (b) The multicast spanning tree for host 1. (c) The multicast spanning tree for host 2.
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.
Expedited Forwarding
Expedited packets experience a traffic-free network.
Assured Forwarding
A possible implementation of the data flow for assured forwarding.
Label Switching and MPLS
Transmitting a TCP segment using IP, MPLS, and PPP.
Internetworking
• How Networks Differ
• How Networks Can Be Connected
• Concatenated Virtual Circuits
• Connectionless Internetworking
• Tunneling
• Internetwork Routing
• Fragmentation
How Networks Differ
Some of the many ways networks can differ.
5-43
How Networks Can Be Connected
(a) Two Ethernets connected by a switch. (b) Two Ethernets connected by routers.
Concatenated Virtual Circuits
Internetworking using concatenated virtual circuits.
Connectionless Internetworking
A connectionless internet.
Tunneling
Tunneling a packet from Paris to London.
Fragmentation
(a) Transparent fragmentation. (b) Nontransparent fragmentation.
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.
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
Internet Control Message Protocol
The principal ICMP message types.
5-61
Address Resolution Protocol
Internet Structurea) Federated network of Autonomous Systems
– Routers and links controlled by a single entity– Routing between ASes, and within an AS
1
2
3
4
5
67
Web clientWeb server
Two-Tiered Internet Routing System
a) Inter-domain routing: between ASes
– Routing policies based on business relationships
– No common metrics, and limited cooperation
– BGP: policy-based, path-vector routing protocol
b) Intra-domain routing: within an AS
– Shortest-path routing based on link metrics
– Routers all managed by a single institution
– OSPF and IS-IS: link-state routing protocol
– RIP and EIGRP: distance-vector routing protocol
Autonomous Systems (AS)
Ethernet
Router
Ethernet
Ethernet
RouterRouter
Ethernet
Ethernet
EthernetRouterRouter
Router
AutonomousSystem 2
AutonomousSystem 1
OSPF (1)
The relation between ASes, backbones, and areas in OSPF.
OSPF (2)
The five types of OSPF messeges.
5-66
BGP – The Exterior Gateway Routing Protocol
(a) A set of BGP routers. (b) Information sent to F.
Mobile IP
a) Mobile node moves to new location
b) Agent Advertisement by foreign agent
c) Registration of mobile node with home agent
d) Proxy by home agent for mobile node
e) Encapsulation of packets
f) Tunneling by home agent to mobile node via foreign agent
Description IPv6
a) The 20-bit Flow Label field in the IPv6 header may be used by a source to label sequences of packets for which it requests special handling by the IPv6 routers, such as non-default quality of service or "real-time" service. Hosts or routers that do not support the functions of the Flow Label field are required to set the field to zero when originating a packet, pass the field on unchanged when forwarding a packet, and ignore the field when receiving a packet.
a) The 8-bit Traffic Class field in the IPv6 header is available for use by originating nodes and/or forwarding routers to identify and distinguish between different classes or priorities of IPv6 packets.
Extension Headers
IPv6 extension headers.
5-69