Computer Networks: Network Layer 1 Prof. Jerry Breecher CSCI 280 Spring 2002
Computer Networks: Network Layer 1 Prof. Jerry Breecher CSCI 280 Spring 2002
Chapter 5
Network Layer 1
Chap. 5- Net1 2
Chapter Overview
The Network Layer is concerned about getting
packets from source to destination, no
matter how many hops it may take. It’s all
about routing.
5.4 Internetworking
Working with multiple networks and protocols in
order to deliver packets.
Chap. 5- Net1 4
Network Layer Overview
Design Issues
WHO-DOES-WHAT-ISSUES:
• 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.
Chap. 5- Net1 5
Network Layer Overview
Design Issues
ROUTING ISSUES:
1. Correctness and simplicity: networks are never taken down; individual parts (e.g.,
links, routers) may fail, but the whole network should not.
2. Stability: if a link or router fails, how much time elapses before the remaining routers
recognize the topology change? (Some never do..)
When we look at routing in detail, we'll consider both adaptive-those that take current traffic
and topology into consideration-and nonadaptive algorithms.
Chap. 5- Net1 6
Network Layer Overview
Design Issues
CONGESTION (NOT CONTENTION):
When more packets enter an area than can be processed, delays increase and performance decreases.
If the situation continues, the subnet may have no alternative but to discard packets.
If the delay increases, the sender may (incorrectly) retransmit, making a bad situation even worse.
Overall, performance degrades because the network is using (wasting) resources processing packets
that eventually get discarded.
INTERNETWORKING:
When we consider internetworking, connecting different network technologies together, there are the
same problems, only worse:
Chap. 5- Net1 7
Network Layer Services Provided to the
Design Issues Transport Layer
The network layer should shield the transport layer from having to know details of the
underlying subnet
The Transport layer should do exactly the same thing, whether sending across LAN or
across the country on the Internet.
Should the host or the subnet be responsible for the delivery of all packets in order ?
Chap. 5- Net1 8
Network Layer Services Provided to the
Design Issues Transport Layer
Review of Definitions:
Connection-Oriented Service: The subnet, with the help of the network layer, should
provide the following operations:
1. The sending side of the pair should open a connection with its peer.
2. This connection has properties negotiated by the pair.
3. Communication is bi-directional and packets are delivered in order.
4. Flow control is accomplished in the subnet.
Connectionless Service: The subnet has no state information. It does only send_packet
and receive_packet. Error control and flow control are done by the host (network or
higher layers.)
Virtual Circuit: Avoids choosing a new route for each packet. A virtual circuit is a state -- it
remembers how to send a packet from source to destination. This state is held in the
subnet, in the source DLL or in each of the DLL layers along the route.
Datagrams: Each packet sent is routed independently of its predecessors. Decisions are
made "on the fly", so more computing required, however this method is more robust.
Chap. 5- Net1 9
Network Layer TWO VIEWS OF THE WORLD
Design Issues
Two views on the question:
“Does error control belong in network or transport layer?”
Chap. 5- Net1 10
Network Layer TWO VIEWS OF THE WORLD
Design Issues
COMPARISON OF VIRTUAL CIRCUITS
AND DATAGRAMS:
Note that:
• Connection Oriented Service
generally use Virtual Circuits.
Chap. 5- Net1 11
Overview
Routing Algorithms
5.1 Network Layer Design Issues What matters when doing routing?
5.2 Routing Algorithms
5.3 Congestion Control What are various techniques to do
Algorithms that routing?
5.4 Internetworking
5.5 The Network Layer in the
Internet Which is best?
Chap. 5- Net1 12
Routing Algorithms Overview
Routing is concerned with the question: Which line should router J use when forwarding a packet
to router K ?
Adaptive algorithms - use such dynamic information as current topology, load, delay, etc. to
select routes.
Nonadaptive algorithms - routes never change once initial routes have been selected. Also
called static routing.
Obviously, adaptive algorithms are more interesting, as nonadaptive algorithms don't even make
an attempt to handle failed links.
Chap. 5- Net1 13
Routing Algorithms Overview
1. Isolated: each router makes its routing decisions using only the local information it has on
hand. Specifically, routers do not even exchange information with their neighbors.
2. Centralized: a centralized node makes all routing decisions. Specifically, the centralized node
has access to global information.
Chap. 5- Net1 14
Routing Algorithms Optimality Principle
This simply states that 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 this same path.
Chap. 5- Net1 15
Routing Algorithms Shortest Path
What if we `know' the complete topology of the network? Can look at computing the optimal path.
What if we have the following network and we want to route a packet from node A to node G. What is the
shortest path (do not initially show distance).
• Choose the source, and put nodes connected to source in list to consider.
Non-Adaptive
Algorithm
Chap. 5- Net1 16
Routing Algorithms Shortest Path
Algorithm results:
Guaranteed to get the shortest path? How to prove? If an alternate shorter path to a node then we would
have already tried the path.
Non-Adaptive
Algorithm
Chap. 5- Net1 17
Routing Algorithms Flooding
Flooding is a form of isolated routing. Does not select a specific route. When a router receives a
packet, it sends a copy of the packet out on each line (except the one on which it arrived):
To prevent packets from looping forever, each router decrements a hop count contained in the
packet header. Whenever the hop count decrements to zero, the router discards the packet.
Chap. 5- Net1 18
Routing Algorithms Flooding
1. In military applications, the network must remain robust in the face of (extreme) hostility
2. Sending routing updates, because updates can't rely on the correctness of a router's
routing table.
In selective flooding, a router sends packets out only on those lines in the general direction of
the destination. That is, don't send packets out on lines that clearly lead in the wrong
direction.
Non-Adaptive
Algorithm
Chap. 5- Net1 19
Routing Algorithms Flow Based Routing
Takes into account both the topology AND the load (BUT still static.)
Assumes:
1. Traffic flows remain constant over time.
2. We can estimate the flow between all pairs of routers.
3. We know the topology of the network and the capacity of each link.
Given the line capacity and the flow, we can determine the delay. From that, we can calculate the
delay for the whole subnet, and between any two nodes.
Non-Adaptive
Algorithm Chap. 5- Net1 20
Routing Algorithms Flow Based Routing
Need to use the formula for delay time: Non-Adaptive
1 Algorithm
T = ----------------
C -
Chap. 5- Net1 21
Routing Algorithms Adaptive Routing
1. Centralized - uses a routing control center (RCC). Creates, modifies, and distributes
routing tables to other routers. Gathers information from the routers.
d) Synchronization of updates (some routers change, but not others, so could have
situation where two routers send at each other).
Adaptive
Algorithm
Chap. 5- Net1 22
Routing Algorithms Adaptive Routing
Backward learning - each packet contains source address and number of hops so far. Use this
information to learn shortest path to each source. Will learn shortest path to all routers.
Only deal with good news, not bad. `Good' may no longer be good due to down router
or congestion.
Must periodically forget and start over (with sub optimal performance after a purge).
Adaptive
Algorithm
Chap. 5- Net1 23
Routing Algorithms Distance Vector Routing
1. 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.
2. Each router knows the distance (cost) of reaching its neighbors (e.g. send echo
requests).
– Compares the metric in its local table with the metric in the neighbor's table plus
the cost of reaching that neighbor.
– if the path via the neighbor has a lower cost, the router updates its local table to
forward packets to the neighbor.
Adaptive
Algorithm
Chap. 5- Net1 24
Routing Algorithms Distance Vector Routing
Use Figure 5.10 as an example.
This algorithm was used in the original ARPANET. Unfortunately, it suffers from the problem:
good news travels quickly, bad news travels slowly (count-to-infinity problem).
The fundamental problem with the old Arpanet algorithm is that it continues to use `old'
information that is invalid, even after newer information becomes available.
Adaptive
Algorithm
Chap. 5- Net1 25
Routing Algorithms Link State Routing
The `old' Arpanet routing algorithm was replaced in 1979. Problems with old
algorithm included:
2. Network was too slow in adapting to congestion, too fast to react to minor
changes.
– This works only if all lines have the same capacity and propagation
delay.d
– Doesn't take into account that packets have varying sizes.
Adaptive
Algorithm
Chap. 5- Net1 26
Routing Algorithms Link State Routing
In the new algorithm:
1. Each router maintains a database describing the topology and link delays between each router. That
is, each router keeps track of the full graph of links and nodes.
5. Each router uses an SPF algorithm to calculate shortest paths based on the current values in its
database.
6. Because each router makes its calculation using the same information, better routing decisions are
made.
Adaptive
Algorithm
Chap. 5- Net1 27
Routing Algorithms Link State Routing
2. Doesn't scale well, as each router receives updates from all other routers.
– Today, we need to think of scaling to a system with a million nodes and
many more links!
– After all, 5 billion people will (eventually) be on the network!
Adaptive
Algorithm
Chap. 5- Net1 28
Routing Algorithms Hierarchical Routing
Hierarchical routing is an approach that hides information from far-away nodes, reducing the
amount of information a given router needs to perform routing:
Divide the network into regions, with a router only knowing the details of how to route to other
routers in its region.
a) In particular, a router does not know about the internal topology of other regions.
b) Gateway is a router that knows about other regions.
A node in each region is designated as an entry point, and the entry point knows how to reach
the entry points in all the other regions.
Chap. 5- Net1 29
Routing Algorithms Hierarchical Routing
Advantage: Scaling. Each router needs less information (table space) to perform
routing.
Disadvantage: Sub optimal routes. The average path length increases because
there may be a shorter path that bypasses the entry points, but we don't
use it.
Adaptive
Algorithm
Chap. 5- Net1 30
Routing Algorithms Broadcast Routing
2. Flood packets to all nodes. Flooding generates many packets and consumes too much
bandwidth.
If the packet arrives on another line, assume that the packet is a copy - it didn't
arrive on the shortest path - and discard it.
Adaptive
Algorithm
Chap. 5- Net1 32
Routing Algorithms Other Routing
Mobile Hosts - machines that are not currently connected to their home location. Must get traffic to base
host. Need intermediary agents. Look at Figures 5.18, 5.19. Base host uses encapsulation
(tunneling) to send packet to mobile host.
Areas have: Foreign Agents - keep track of mobile users visiting an area.
Home Agent - keep track of users whose home is in the area but are away.
Chap. 5- Net1 34
Congestion Control Overview
CONGESTION MECHANISMS:
When one part of the subnet (e.g. one or more routers in an area) becomes overloaded,
congestion results. Congestion can be dealt with by:
1. Congestion control - when the problem occurs, limit senders or reroute. This is a
reactive mode. (No, this is not an antihistamine!!)
2. Congestion prevention - make resources available and enforce good behavior so that
the congestion won't occur.
Congestion control means making sure the subnet can handle the offered traffic.
Flow control means preventing one sender from overflowing one receiver. Congestion deals
with wires and routers, while flow deals with hosts.
Chap. 5- Net1 35
Congestion Control Overview
Chap. 5- Net1 36
Congestion Control Congestion Prevention
Policies
Pre-allocation schemes aim to prevent congestion from happening in the first place.
• For example, we can require that resources be pre-allocated before any packets can be
sent, guaranteeing that resources will be available to process each packet.
In virtual circuit networks, for example, the sender opens a connection before sending data.
• The circuit setup operation selects a path through the subnet, and each router on the path
dedicates buffer space and bandwidth to the new circuit.
What happens when a user attempts to open a virtual circuit and the subnet is congested?
• The subnet can refuse to open the connection, forcing the user to wait until sufficient
resources become available.
Note: The ability of the subnet to reject requests to open connections is an important property of
connection oriented networks.
Chap. 5- Net1 37
Congestion Control Traffic Shaping
Control the rate at which packets are sent (not just how many). Widely used in ATM networks.
At set up, the sender and carrier negotiate a traffic pattern (shape).
Leaky Bucket Algorithm used to control rate in a datagram network. Fig. 5.24.
• A single-server queue with constant service time.
• If bucket (buffer) overflows then packets are discarded.
Enforces a constant output rate regardless of burstiness of input. Does nothing when input is idle.
The Token Bucket Algorithm causes a token to be generated periodically, which during idle
periods can be saved up.
Related to traffic shaping is flow specification, where a particular quality of service is agreed upon
between sender, receiver and carrier.
Chap. 5- Net1 38
Congestion Control Flow Control
Flow control is one way of preventing a fast sender from overwhelming a slow receiver. Flow control can
be helpful at reducing congestion, but it can't really solve the congestion problem. For example,
suppose we connect a fast sender and fast receiver (e.g., two Crays) using a 9.6 kbps line:
• If the two machines use a sliding window protocol, and the window is large, the link will become
congested in a hurry.
• If the window size is small (e.g., 2 packets), the link won't become congested. Note how the window
size limits the total number of packets that can be in transmission at one time.
• User process to user process (end-to-end). Later, we'll see how TCP uses flow control at the end-
to-end level.
• Host to host. For example, if multiple application connections share a single virtual circuit between
two hosts.
Chap. 5- Net1 39
Congestion Control Choke Packets
Advantage:
1. Dynamic. Host sends as much data as it wants, the network informs it when it is
sending too much.
Chap. 5- Net1 40
Congestion Control Choke Packets
Disadvantages:
1. Difficult to tune.
a) By how much should a host slow down?
b) The answer depends on how much traffic the host is sending, how much of the
congestion it is responsible for, and the total capacity of the congested region.
c) Such information is not readily available in practice.
Desirable:
More attention paid to reserving resources so that chances of congestion are reduced
and the quality of service is more reliable.
Chap. 5- Net1 41
Congestion Control Load Shedding
Opposite Approach:
• We could preallocate no resources in advance, and take our chances that
resources will be available when we need them.
• When insufficient resources are present to process existing packets, discard
queued packets to make room for newly arriving ones.
• In virtual circuit networks, the previous-hop router retransmits the packet when it
fails to receive an acknowledgment.
Chap. 5- Net1 42
Congestion Control Load Shedding
• Because the router has no free buffers, it cannot accept additional frames.
• Unfortunately, it also ignores frames containing ACKs that would free up some
of those buffers!
• If two adjacent routers, A and B, are sending packets to each other, since both
are waiting for the other to accept a packet, neither can proceed.
Solution: Reserve at least one buffer for each input line and use it to hold incoming
packets. Note that we can extract the ACK field and still discard the packet, if we
don't have buffers to hold it.
Chap. 5- Net1 43
Congestion Control Load Shedding
1. Wastes resources. The network may have expended considerable resources processing a
packet that is eventually discarded.
2. Non-deterministic. There is less guarantee than with virtual circuits that packets will ever
reach their destination.
3. Requires that sending hosts pay attention to congestion. If the network can't prevent a host
from sending data, a host can overload the network. In particular, a `broken' host may cause
the network to become overly congested.
Chap. 5- Net1 44