Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

The Network Layer: Andrew S. Tanenbaum Computer Networks Fourth Edition PP. 343-396

Download as pdf or txt
Download as pdf or txt
You are on page 1of 82

Chapter 5

(Week 9)

The Network Layer


ANDREW S. TANENBAUM
COMPUTER NETWORKS
FOURTH EDITION
PP. 343-396

826501 CN&DC 1
Dr.Refik Samet
5.1. NETWORK LAYER DESIGN ISSUES
5.2. ROUTING ALGORITHMS
5.3. CONGESTION CONTROL
ALGORITHMS
5.4. QUALITY OF SERVICE
5.5. INTERNETWORKING
5.6. THE NETWORK LAYER IN THE
INTERNET
5.7. SUMMARY
826501 CN&DC 2
Dr.Refik Samet
PREVIOUS LAYERS

• The purpose of the physical layer is to


transport a raw bit stream from one
machine to another.
• The main task of the data link layer is
to transform a raw transmission faculty
into a line that appears free of
undetected transmission errors to the
network layer.
826501 CN&DC 3
Dr.Refik Samet
The Network Layer (1)
• This layer is concerned with getting
packets from the source all the way to the
destination.
• Getting to the destination may require
making many hops at intermediate routers
along the way.
• Thus, the network layer is the lowest layer
that deals with end-to-end transmission.
826501 CN&DC 4
Dr.Refik Samet
The Network Layer (2)
• To achieve its goals, the network layer
must know about the topology of the
communication subset (i.e., the set of all
routers) and choose appropriate paths
through it.
• It must also take care to choose routes to
avoid overloading some of the
communication lines and routers while
leaving others idle.
826501 CN&DC 5
Dr.Refik Samet
The Network Layer (3)
• Finally, when the source and destination
are in different networks, new problems
occur. It is up to the network layer to deal
with them.
• In this chapter we will study all these
issues and illustrate them, primarily using
the Internet and its network layer
protocol, IP, although wireless networks
will also be addressed.
826501 CN&DC 6
Dr.Refik Samet
5.1. Network Layer Design Issues (1)
•In the following sections we will provide an
introduction to some of the issues that the
designers of the network layer must grapple
with.
•These issues include the service provided to
the transport layer and the internal design of
the subnet.

826501 CN&DC 7
Dr.Refik Samet
5.1. Network Layer Design Issues (2)

• 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

826501 CN&DC 8
Dr.Refik Samet
5.1. Network Layer Design Issues (3)
1. Store-and-Forward Packet Switching (1)
• Let us restate the context in which the
network layer protocols operate.

826501 CN&DC 9
Dr.Refik Samet
5.1. Network Layer Design Issues (4)
1.Store-and-Forward Packet Switching (2)

fig 5-1

The environment of the network layer protocols.


826501 CN&DC 10
Dr.Refik Samet
5.1. Network Layer Design Issues (5)
1.Store-and-Forward Packet Switching (3)
• A host with a packet to send transmits it
to the nearest router, either on its own
LAN or over a point-to-point link to the
carrier.
• The packet is stored there until it has fully
arrived so the checksum can be verified.

826501 CN&DC 11
Dr.Refik Samet
5.1. Network Layer Design Issues (6)
1.Store-and-Forward Packet Switching (4)
• Then it is forwarded to the next router
along the path until it reaches the
destination host, where it is delivered.
• This mechanism is store-and-forward
packet switching, as we have seen in
previous chapters.

826501 CN&DC 12
Dr.Refik Samet
5.1. Network Layer Design Issues (7)
2.Services Provided to the Transport Layer (1)
• The network layer provides services to the
transport layer at the network
layer/transport layer interface.
• An important question is what kind of
services the network layer provides to the
transport layer.
• The network layer services have been
designed with the following goals in mind.
826501 CN&DC 13
Dr.Refik Samet
5.1. Network Layer Design Issues (8)
2.Services Provided to the Transport Layer (2)
a) The services should be independent of the
router technology.
b) The transport layer should be shielded from
the number, type, and topology of the
routers present.
c) The network addresses made available to
the transport layer should use a uniform
numbering plan, even across LANs and
WANs. 826501 CN&DC 14
Dr.Refik Samet
5.1. Network Layer Design Issues (9)
2.Services Provided to the Transport Layer (3)
•The discussion centers on whether the
network layer should provide connection-
oriented service or connectionless service.
•Internet community’s opinion: the routers’ job
is moving packets around and nothing else.
The subnet is inherently unreliable. Therefore,
the hosts should accept the fact that the
network is unreliable and do error control and
flow control themselves.
826501 CN&DC 15
Dr.Refik Samet
5.1. Network Layer Design Issues (10)
2.Services Provided to the Transport Layer (4)
•This viewpoint leads quickly to the
conclusion that the network service should be
connectionless, with primitives SEND
PACKET and RECEIVE PACKET.
•Furthermore, each packet must carry the full
destination address, because each packet sent
is carried independently of its predecessors, if
any.
826501 CN&DC 16
Dr.Refik Samet
5.1. Network Layer Design Issues (11)
2.Services Provided to the Transport Layer (5)
•Telephone companies’ opinion: the subnet
should provide a reliable, connection-
oriented service.
•In this view, quality of service is the
dominant factor, and without connections in
the subnet, quality of service is very difficult
to achieve, especially for real-time traffic
such as voice and video.
826501 CN&DC 17
Dr.Refik Samet
5.1. Network Layer Design Issues (12)
2.Services Provided to the Transport Layer (6)
•The Internet offers connectionless network-
layer service.
•ATM networks offer connection-oriented
network-layer service.
•However, it is interesting to note that as
quality-of-service guarantees are becoming
more and more important, the Internet is
evolving.
826501 CN&DC 18
Dr.Refik Samet
5.1. Network Layer Design Issues (13)
3. Implementation of Connectionless Service (1)
•If connectionless service is offered, packets
are injected into the subnet individually and
routed independently of each other.
•In this context, the packets are frequently
called datagrams and the subnet is called a
datagram subnet.

826501 CN&DC 19
Dr.Refik Samet
5.1. Network Layer Design Issues (14)
3.Implementation of Connectionless Service (2)

Routing within a diagram subnet.


826501 CN&DC 20
Dr.Refik Samet
5.1. Network Layer Design Issues (15)
3.Implementation of Connectionless Service (3)
Routers
• When a packet comes into a router, the
frame header and trailer are stripped off
and the packet located in the frame’s
payload field is passed to the routing
software. This software uses the packet
header to choose an output line.
826501 CN&DC 21
Dr.Refik Samet
5.1 Network Layer Design Issues (16)
3. Implementation of Connectionless Service(3)
•Each router has an internal table telling it
where to send packets for each possible
destination.
•The algorithm that manages the tables and
makes the routing decisions is called the
routing algorithm. Routing algorithms are
one of the main things we will study in this
chapter.
826501 CN&DC 22
Dr.Refik Samet
5.1 Network Layer Design Issues (17)
4. Implementation of Connection-Oriented Service (1)
•If connection-oriented service is used, a path
from the source router to the destination
router must be established before any data
packets can be sent.
•This connection is called a VC (virtual
circuit), in analogy with the physical circuits
set up by the telephone system, and the
subnet is called a virtual-circuit subnet.
826501 CN&DC 23
Dr.Refik Samet
5.1 Network Layer Design Issues(18)
4.Implementation of Connection-Oriented Service (2)
•When a connection is established, a route
from the source machine to the destination
machine is chosen as part of the connection
setup and stored in tables inside the routers.
•When the connection is released, the virtual
circuit is also terminated.
•With connection-oriented service, each
packet carries an identifier telling which
virtual circuit it belongs to.
826501 CN&DC 24
Dr.Refik Samet
5.1.Network Layer Design Issues(19)
4.Implementation of Connection-Oriented Service (3)

Routing within a virtual-circuit subnet.


826501 CN&DC 25
Dr.Refik Samet
5.1 Network Layer Design Issues (20)
5. Comparison of Virtual-Circuit and Datagram Subnets(1)
•Both virtual circuits and datagrams have
their supporters and their detractors.
•One trade-off is between router memory
space and bandwidth. VC allow packets to
contain circuit numbers instead of full
destination addresses. If the packets tend to
be fairly short, a full destination address in
every packet may represent a significant
amount of overhead and hence, wasted
bandwidth. 826501 CN&DC
Dr.Refik Samet
26
5.1 Network Layer Design Issues (21)
5. Comparison of Virtual-Circuit and Datagram Subnets(2)
•Another trade-off is setup time versus
address parsing time.
•Using VC requires a setup phase, which
takes time and consumes resources.
•VC have some advantages in guaranteeing
quality of service and avoiding congestion
within the subnet because resources can be
reserved in advance, when the connection is
established. 826501 CN&DC 27
Dr.Refik Samet
5.1 Network Layer Design Issues (22)
5. Comparison of Virtual-Circuit and Datagram Subnets (3)

5-4

826501 CN&DC 28
Dr.Refik Samet
5.2 Routing Algorithms (1)
• The main function of NL (Network
Layer) is routing packets from the source
machine to the destination machine.
• The algorithms that choose the routes and
the data structures that they use are a
major area of network layer design.
• The routing algorithm is that part of the
NL software responsible for deciding
which output line an incoming packet
should be transmitted on.
826501 CN&DC 29
Dr.Refik Samet
5.2 Routing Algorithms (2)
• There are two processes inside router:
a) One of them handles each packet as it
arrives, looking up the outgoing line to
use for it in the routing table. This
process is forwarding.
b) The other process is responsible for
filling in and updating the routing tables.
That is where the routing algorithm
comes into play. This process is routing.
826501 CN&DC 30
Dr.Refik Samet
5.2 Routing Algorithms (3)
• Regardless of whether routes are chosen
independently for each packet or only
when new connections are established,
certain properties are desirable in a
routing algorithm:
• correctness, simplicity,
• robustness, stability,
• fairness, and optimality.
826501 CN&DC 31
Dr.Refik Samet
5.2 Routing Algorithms (4)
• Correctness and simplicity hardly require
coment.
• Robustness: the routing algorith should
be able to cope with changes in topology
and traffic without requiring all jobs in all
hosts to be aborted and the network to be
rebooted every time some router crashes.

826501 CN&DC 32
Dr.Refik Samet
5.2 Routing Algorithms (5)
• Stability is also an important goal for the
routing algorithm. A stable algorithm
reaches equilibrium and stays there.
• Fairness and optimality may sound
obvious – surely no reasonable person
would oppose them – but as it turn out,
they are often contradictory goals.

826501 CN&DC 33
Dr.Refik Samet
5.2 Routing Algorithms (6)

Conflict between fairness and optimality.


826501 CN&DC 34
Dr.Refik Samet
5.2 Routing Algorithms (7)
• Routing algorithms can be grouped into two
major classes: nonadaptive and adaptive.
• Nonadaptive algorithm do not base their
routing decisions on measurements or
estimates of the current traffic and topology.
Instead, the choice of the route to use to get
from I to J is computed in advance, off line,
and downloaded to the routers when the
network is booted. This procedure is
sometimes called static routing.
826501 CN&DC 35
Dr.Refik Samet
5.2 Routing Algorithms (8)
•Adaptive algorithm, in contrast, change their routing
decisions to reflect changes in the topology, and
usually the traffic as well.
•Adaptive algorithms differ in where they get their
information (e.g., locally, from adjacent routers, or
from all routers), when they change the routes (e.g.,
every ∆T sec, when the load changes or when the
topology changes), and what metric is used for
optimization (e.g., distance, number of hops, or
estimated transit time). This procedure is called
dynamic routing. 826501 CN&DC 36
Dr.Refik Samet
5.2 Routing Algorithms (9)
• 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
826501 CN&DC 37
Dr.Refik Samet
5.2 Routing Algorithms (10)
The Optimality Principle (1)
•One can make a general statement about
optimal routes without regard to network
topology or traffic.
•This statement is known as the optimality
principle.
•It 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 the same
route.
826501 CN&DC 38
Dr.Refik Samet
5.2 Routing Algorithms (11)
The Optimality Principle (2)
•As a direct consequence of the optimality
principle, we can see that the set of optimal
routes from all sources to a given
destination form a tree rooted at the
destination.
•Such a tree is called a sink tree.
•The goal of all routing algorithms is to
discover and use the sink trees for all routers
826501 CN&DC 39
Dr.Refik Samet
5.2 Routing Algorithms (12)
The Optimality Principle (3)

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


826501 CN&DC 40
Dr.Refik Samet
5.2 Routing Algorithms (13)
Shortest Path Routing (1)
•The idea is to build a graph of the subnet,
with each node of the graph representing a
router and each arc of the graph representing
a communication line or link.
•To choose a route between a given pair of
routers, the algorithm just finds the shortest
path between them on the graph.

826501 CN&DC 41
Dr.Refik Samet
5.2 Routing Algorithms (14)
Shortest Path Routing (2)

The first 5 steps used in computing the shortest path from A to D.


The arrows indicate the working node.
826501 CN&DC 42
Dr.Refik Samet
5.2 Routing Algorithms (15)
Shortest Path Routing (3)
•Many other metrics besides hops and
physical distance are also possible.
•For example, each arc could be labeled with
the mean queuing and transmission delay for
some standard test packet as determined by
hourly test runs.
•With this graph labeling, the shortest path is
the fastest path rather than the path with the
fewest arcs or kilometers.
826501 CN&DC 43
Dr.Refik Samet
5.2 Routing Algorithms (16)
Shortest Path Routing (4)
•In the general case, the labels on the arcs
could be computed as a function of the
distance, bandwidth, average traffic,
communication cost, mean queue length,
measured delay, and other factors.
•By changing the weighting function, the
algorithm would then compute the “shortest”
path measured according to any one of a
number of criteria or to a combination of
criteria. 826501 CN&DC 44
Dr.Refik Samet
5.2 Routing Algorithms (17)
Shortest Path Routing (5)

5-8 top

Dijkstra's algorithm to compute the shortest path through a graph.


826501 CN&DC 45
Dr.Refik Samet
5.2 Routing Algorithms (18)
Shortest Path Routing (6)

5-8
bottom

Dijkstra's algorithm to compute the shortest path through a graph.


826501 CN&DC 46
Dr.Refik Samet
5.2 Routing Algorithms (19)
Flooding (1)
• Another static algorithm is flooding, in
which every incoming packet is sent out
on every outgoing line except the one it
arrived on.
• Flooding obviously generates vast
numbers of duplicate packets, in fact, an
infinite number unless some measures are
taken to damp the process.
826501 CN&DC 47
Dr.Refik Samet
5.2 Routing Algorithms (20)
Flooding (2)
• One such measure is to have a hop
counter contained in the header of each
packet, which is decremented at each
hop, with the packet being discarded
when the counter reaches zero.
• Ideally, the hop counter should be
initialized to the length of the path from
source to destination.
826501 CN&DC 48
Dr.Refik Samet
5.2 Routing Algorithms (21)
Flooding (3)
• A variation of flooding that is slightly
more practical is selective flooding.
• In this algorithm the routers do not send
every incoming packet out on every line,
only on those lines that are going
approximately in the right direction.
• Flooding is not practical in most
applications.
826501 CN&DC 49
Dr.Refik Samet
5.2 Routing Algorithms (22)
Distance Vector Routing (1)
• Distance Vector Routing is dynamic
routing algorithm.
• Distance Vector Routing algorithms
operate by having each router maintain a
table (i.e., a vector) giving the best
known distance to each destination and
which line to use to get there.
• These tables are updated by exchanging
information with the neighbors.
826501 CN&DC 50
Dr.Refik Samet
5.2 Routing Algorithms (23)
Distance Vector Routing (2)
• As an example, assume that delay is used
as a metric and that the router knows the
delay to each of its neighbors.
• Once every T msec each router sends to
each neighbor a list of its estimated
delays to each destination.
• It also receives a similar list from each
neighbor.
826501 CN&DC 51
Dr.Refik Samet
5.2 Routing Algorithms (24)
Distance Vector Routing (3)

(a) A subnet. (b) Input from A, I, H, K, and the new


routing table for J. 826501 CN&DC 52
Dr.Refik Samet
5.2 Routing Algorithms (25)
Distance Vector Routing (4)
The Count-to-Infinity Problem (1)
•Distance Vector Routing works in theory
but has a serious drawback in practice.
•In particular, it reacts rapidly to good news,
but leisurely to bad news.
•The core of the problem is that when X tells
Y that it has a path somewhere, Y has no
way of knowing whether it itself is on the
path. 826501 CN&DC
Dr.Refik Samet
53
5.2 Routing Algorithms (26)
Distance Vector Routing (5)
The Count-to-Infinity Problem (2)

The count-to-infinity problem.


826501 CN&DC 54
Dr.Refik Samet
5.2 Routing Algorithms (27)
Link State Routing (1)
•Two primary problems caused distance
vector routing’s demise.
•First, since the delay metric was queue
length, it did not take line bandwidth into
account when choosing routes.
•Second, the algorithm often took too long
to converge (the count-to-infinity problem)
826501 CN&DC 55
Dr.Refik Samet
5.2 Routing Algorithms (28)
Link State Routing (2)
•Distance vector routing was replaced by
Link State Routing
•Link State Routing is also dynamic
routing algorithm.

826501 CN&DC 56
Dr.Refik Samet
5.2 Routing Algorithms (29)
Link State Routing (3)
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. 826501 CN&DC 57
Dr.Refik Samet
5.2 Routing Algorithms (30)
Link State Routing (4)
Learning about the Neighbors

(a) Nine routers and a LAN. (b) A graph model of (a).


826501 CN&DC 58
Dr.Refik Samet
5.2 Routing Algorithms (31)
Link State Routing (5)
Measuring Line Cost

A subnet in which the East and826501


West parts are connected by two 59
CN&DC
lines.
Dr.Refik Samet
5.2 Routing Algorithms (32)
Link State Routing (6)
Building Link State Packets

(a) A subnet. (b) The link state packets for this subnet.
826501 CN&DC 60
Dr.Refik Samet
5.2 Routing Algorithms (33)
Link State Routing (7)
Distributing the Link State Packets

The packet buffer for router B in the previous slide


826501 CN&DC 61
Dr.Refik Samet
5.2 Routing Algorithms (34)
Link State Routing (8)
Computing the New Routes
• Once a router has accumulated a full set
of link state packets, it can construct the
entire subnet graph because every link
is represented.
• Every link is, in fact, represented twice,
once for each direction.

826501 CN&DC 62
Dr.Refik Samet
5.2 Routing Algorithms (35)
Hierarchical Routing

Hierarchical routing.
826501 CN&DC 63
Dr.Refik Samet
5.2 Routing Algorithms (36)
Broadcast Routing

Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The
tree built by reverse path forwarding.
826501 CN&DC 64
Dr.Refik Samet
5.2 Routing Algorithms (37)
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.
826501 CN&DC 65
Dr.Refik Samet
5.2 Routing Algorithms (38)
Routing for Mobile Hosts (1)

A WAN to which LANs, MANs, and wireless cells are attached.


826501 CN&DC 66
Dr.Refik Samet
5.2 Routing Algorithms (39)
Routing for Mobile Hosts (2)

Packet routing for mobile users.


826501 CN&DC 67
Dr.Refik Samet
5.2 Routing Algorithms (40)
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.
826501 CN&DC 68
Dr.Refik Samet
5.2 Routing Algorithms (41)
Route Discovery (1)

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.
826501 CN&DC 69
Dr.Refik Samet
5.2 Routing Algorithms (42)
Route Discovery (2)

Format of a ROUTE REQUEST packet.

826501 CN&DC 70
Dr.Refik Samet
5.2 Routing Algorithms (43)
Route Discovery (3)

Format of a ROUTE REPLY packet.

826501 CN&DC 71
Dr.Refik Samet
5.2 Routing Algorithms (44)
Route Maintenance

(a) D's routing table before G goes down.


(b) The graph after G has gone down.

826501 CN&DC 72
Dr.Refik Samet
5.2 Routing Algorithms (45)
Node Lookup in Peer-to-Peer Networks

(a) A set of 32 node identifiers arranged in a circle. The shaded ones


correspond to actual machines. The arcs show the fingers from
nodes 1, 4, and 12. The labels on the arcs are the table indices.
(b) Examples of the finger tables.
826501 CN&DC 73
Dr.Refik Samet
5.3. Congestion Control Algorithms (1)

• When too many packets are present in (a


part of) the subnet, performance
degrades.
• This situation is called congestion.

826501 CN&DC 74
Dr.Refik Samet
5.3. Congestion Control Algorithms (2)
Congestion

When too much traffic is offered, congestion sets in and


performance degrades sharply.
826501 CN&DC 75
Dr.Refik Samet
5.3. Congestion Control Algorithms (3)
• Congestion can be brought on by several
factors.
• If all of a sudden, streams of packets begin
arriving on three or four input lines and all
need the same output line, queue will build
up.
• If there is insufficient memory to hold all of
them, packets will be lost.
• Slow processors can also cause congestion
826501 CN&DC 76
Dr.Refik Samet
5.3. Congestion Control Algorithms (4)
• General Principles of Congestion Control
• Congestion Prevention Policies
• Congestion Control in Virtual-Circuit Subnets
• Congestion Control in Datagram Subnets
• Load Shedding
• Jitter Control

826501 CN&DC 77
Dr.Refik Samet
5.3. Congestion Control Algorithms (5)
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.

826501 CN&DC 78
Dr.Refik Samet
5.3. Congestion Control Algorithms (6)
Congestion Prevention Policies

5-26

Policies that affect congestion.


826501 CN&DC 79
Dr.Refik Samet
5.3. Congestion Control Algorithms (5)
Congestion Control in Virtual-Circuit Subnets

(a) A congested subnet. (b) A redrawn subnet, eliminates


congestion and a virtual circuit from A to B.
826501 CN&DC 80
Dr.Refik Samet
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.
826501 CN&DC 81
Dr.Refik Samet
Jitter Control

(a) High jitter. (b) Low jitter.


826501 CN&DC 82
Dr.Refik Samet

You might also like