Unit-4 1 Network Layer
Unit-4 1 Network Layer
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Outline of Unit
• Design issues
• Routing algorithms
• Optimality principle
• Shortest path routing
• Flooding
• Distance vector routing
• Link state routing
• Congestion control algorithms
• Principles
• Prevention policies
• Congestion control in virtual circuit subnets
• Congestion control in datagram subnets
• Load shedding
• Jitter control
• Quality of service
• Requirements
• Techniques for achieving good quality of service
• Internetworking
• Tunnelling
• The network layer in the internet
• The IP protocol
• IP addresses
• Internet control protocol
• OSPF
• BGP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Various functions of network layer
Addressing: Maintains the address at the frame header of
both source and destination and performs addressing to detect
various devices in network.
Packeting: This is performed by Internet Protocol. The
network layer converts the packets from its upper layer.
Routing: It is the most important functionality. The network
layer chooses the most relevant and best path for the data
transmission from source to destination.
Inter-networking: It works to deliver a logical connection
across multiple devices.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Network Layer Design Issues
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
1. Store-and-Forward Packet Switching
ISP’s equipment
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
2. Services Provided to the Transport Layer
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
3. Implementation of Connectionless Service
ISP’s equipment
A’s table (initially) A’s table (later) C’s Table E’s Table
ISP’s equipment
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms(2)
a. Forwarding/Routing
b. Filling and updating the routing table
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms
Certain property are desirable in
Routing algorithm:
1. Correctness
2. Simplicity
3. Robustness
4. Stability
5. Fairness
6. Efficiency
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Fairness vs. Efficiency
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms
• Optimality principle
• Shortest path algorithm
• Flooding
• Distance vector routing
• Link state routing
• Routing in ad hoc networks
• Broadcast routing
• Multicast routing
• Anycast routing
• Routing for mobile hosts
• Routing in ad hoc networks
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Optimality Principle(1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Optimality Principle(2)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Shortest Path Algorithm (1)
• The shortest path algorithm just finds the least expensive
path through the network, based on the cost function.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Shortest Path Algorithm (2)
The first five steps used in computing the shortest path from A
to D. The arrows indicate the working node
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Flooding(1)
• Flooding is the static routing algorithm. In this algorithm,
every incoming packet is sent on all outgoing lines except the
line on which it has arrived.
•Disadvantage: Duplicate Packet
•Application: Millatry, Distributed Database
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Flooding(2)
• Several measures are takes to stop the duplication of packets. These
are:
1. One solution is to include a hop counter in the header of each packet.
This counter is decremented at each hop along the path. When this
counter reaches zero the packet is discarded.
2. Another technique is to keep the track of the packed that have been
flooded, to avoid sending them a second time. For this, the source
router put a sequence number in each packet it receives from its hosts.
Each router then needs a list per source router telling which sequence
numbers originating at that source have already been seen. If an
incoming packet is on the list, it is not flooded.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distance Vector Routing(1)
• Computer networks generally use dynamic routing
algorithms that are more complex than flooding, but more
efficient because they find shortest paths for the current
topology.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distance Vector Routing(1)
• In this routing scheme, each router periodically shares its
knowledge about the entire network with its neighbors.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distance Vector Routing(2)
• Neighboring nodes in the subnet exchange their tables
periodically to update each other on the state of the subnet
(which makes this a dynamic algorithm).
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distance Vector Routing
(a) A network.
(b) Input from A, I, H, K, and the new routing table for J.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Count-to-Infinity Problem
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Solution of Count-to-Infinity Problem
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Link State Routing(1)
• The primary problem with distance vector is the
algorithm often took to long to converge after the
network topology changed (due to counter infinity
problem).
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Link State Routing(2)
Each router must do the following things to make it
work:
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
1. Learning about the Neighbors (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
1. Learning about the Neighbors (2)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
2. Setting link cost
• Find the distance from source to linked node
• Setup cost using bandwidth of link
• Send Hello packet and find the delay
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
3. Building Link State Packets
(a) A network. (b) The link state packets for this network.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
3. Building Link State Packets
Sequence number: each packet contains a sequence number,
this keep tracks how many times packet has been sent.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
4. Distributing the Link State Packets
• The fundamental idea is to use flooding to distribute the link
state packets to all routers.
Problem:
• If the sequence number wrap out.
• If a router ever crashes
• Sequence number ever corrupted
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Conclusion of link state routing
• Compared to distance vector routing, link state routing
require more memory and computation.
• Link state routing is widely used in actual network.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control
• Too many packets present in (a part of) the network causes
packet delay and loss that degrades performance. This
situation is called congestion.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
General Principles of Congestion Control
• Many problems in complex systems, such as computer networks,
can be viewed from a control theory point of view.
• This approach leads to dividing all solutions into two groups: open
loop and closed loop.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
General Principles of Congestion Control
• Closed loop solutions are based on the concept of a feedback loop.
• The closed loop algorithms are also divided into two subcategories:
Explicit feedback versus implicit feedback.
1. In explicit feedback algorithms, packets are sent back from the point of
congestion to warn the source.
2. In implicit algorithms, the source deduces the existence of congestion
by making local observations, such as the time needed for
acknowledgements to come back.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Prevention Policies (Open Loop)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Prevention Policies (Open Loop)
• Network Provisioning :
• Turning on sparse router or enabling lines that are only for backups
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control in Virtual-Circuit Subnets
• Admission Control:
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control in Virtual-Circuit Subnets
• Admission Control
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control in Virtual-Circuit Subnets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
2. Choke Packets:
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
2. Choke Packets:
• Two bits in the IP packet header are used to record whether the packet
experienced congestion.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
A choke packet that affects only the source..
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
3. Hop-by-hop backpressure:
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
A choke packet that affects each hop it passes through.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Load Shedding
• When none of the above methods make the congestion
disappear, routers can bring out the heavy artillery: load
shedding.
• Load shedding is a fancy way of saying that when routers
are being inundated by packets that they cannot handle,
they just throw them away.
• More intelligent load shedding requires cooperation from
the senders
• The key question for a router drowning in packets is which
packets to drop.
• The former policy (old is better than new) is often called wine
policy and the latter (new is better than old) is often called milk
policy because most people would rather drink new milk and old
wine than the alternative.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Load Shedding
• Random Early Detection:
• By having routers drop packets early, before the situation
has become hopeless, there is time for the source to take
action before it is too late. A popular algorithm for doing this
is called RED (Random Early Detection).
• To determine when to start discarding, routers maintain a
running average of their queue lengths. When the average
queue length on some link exceeds a threshold, the link is
said to be congested and a small fraction of the packets are
dropped at random.
• RED routers improve performance compared to routers that
drop packets only when their buffers are full, though they
may require tuning to work well.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
5. Load Shedding (2)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Jitter Control
• The variation (i.e., standard deviation) in the packet arrival
times is called jitter.
• A. High Jitter
• B. Low Jitter
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Jitter Control
• When a packet arrives at a router, the router checks to see
how much the packet is behind or ahead of its schedule.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Quality of Service
• An easy solution to provide good quality of service is to build a
network with enough capacity for whatever traffic will be thrown at it.
The name for this solution is overprovisioning.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Application requirements
• A stream of packets from a source to a destination is called a flow.
• In a connection-oriented network, all the packets belonging to a flow
follow the same route;
• In a connectionless network, they may follow different routes.
• The needs of each flow can be characterized by four primary
parameters:
• reliability,
• delay,
• jitter, and
• bandwidth.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Application requirements
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Application requirements
• The first four applications have stringent requirements on reliability. No
bits may be delivered incorrectly.
• File transfer applications, including e-mail and video, are not delay
sensitive. If all packets are delayed uniformly by a few seconds, no
harm is done.
• Interactive applications, such as Web surfing and remote login, are
more delay sensitive.
• Real-time applications, such as telephony and videoconferencing have
strict delay requirements.
• The first three applications are not sensitive to the packets arriving with
irregular time intervals between them.
• Video and especially audio are extremely sensitive to jitter. If a user is
watching a video over the network and the frames are all delayed by
exactly 2.000 seconds, no harm is done. But if the transmission time
varies randomly between 1 and 2 seconds, the result will be terrible.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Techniques for Achieving Good Quality of Service
• Now that we know something about QoS requirements, how do we
achieve them?
• Well, to start with, there is no magic bullet.
• No single technique provides efficient, dependable QoS in an optimum
way.
• Instead, a variety of techniques have been developed, with practical
solutions often combining multiple techniques.
• We will now examine some of the techniques system designers use to
achieve QoS.
1. Overprovisioning
2. Buffering
3. Traffic Shaping
4. The Leaky Bucket Algorithm
5. The Token Bucket Algorithm
6. Admission Control
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
1. Overprovisioning
• An easy solution is to provide so much router capacity, buffer space, and
bandwidth that the packets just fly through easily.
• As time goes on and designers have a better idea of how much is enough,
this technique may even become practical.
• There is simply so much capacity available there that demand can always
be met.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
2. Buffering
• Flows can be buffered on the receiving side before being delivered.
• Buffering them does not affect the reliability or bandwidth, and increases
the delay, but it smooths out the jitter.
• For audio and video on demand, jitter is the main problem, so this
technique helps a lot.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
3. Traffic Shaping
• Traffic shaping is a technique for regulating the
average rate and burstiness of a flow of data that
enters the network.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Traffic Shaping (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
4. Leaky Bucket
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
4. Token Bucket
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
5. Token Bucket
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
6. Admission Control
• The goal in taking load into account when computing routers is
to shift traffic away from hotspot that will be the first place in the
network to experience congestion.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
6. Admission Control
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
How Networks Differ
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
How Networks Can Be Connected
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Network Layer Principles (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Network Layer Principles (2)
...
6. Avoid static options and parameters
7. Look for good design (not perfect)
8. Strict sending, tolerant receiving
9. Think about scalability
10. Consider performance and cost
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Network Layer in the Internet (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The IP Version 4 Protocol (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The IP Version 4 Protocol (1)
• Version : The Version field keeps track of which version of
the protocol the datagram belongs to. Version 4 dominates
the Internet today, and that is where we have started our
discussion.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
IP Addresses (6)
IP address formats
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
IP Addresses (7)
Special IP addresses
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Private IP vs Public IP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Private IP vs Public IP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Static IP vs Dynamic IP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Static IP vs Dynamic IP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
NAT (Network Address Translation)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
IP Version 6 Goals
• Support billions of hosts
• Reduce routing table size
• Simplify protocol
• Better security
• Attention to type of service
• Aid multicasting
• Roaming host without changing address
• Allow future protocol evolution
• Permit coexistence of old, new protocols. . .
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
IP Version 6 (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
DHCP Client Initialization
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithm Classification
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Interior Gateway Protocol (IGP) and Exterior Gateway Protocol (EGP)
Autonomous System
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Exterior Gateway Protocol (EGP) Exterior Border Gateway Protocol
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
End
Unit 4
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011