Sunteți pe pagina 1din 71

Chapter 5

The Network Layer


Store-and-Forward Packet Switching

fig 5-1

Figure 5.1: The environment of the network layer protocols.


Services Provided to the Transport Layer

• The network layer provides services to the transport


layer at the network layer/transport layer interface.
1) The services should be independent of the router
technology.
2) The transport layer should be shielded from the number,
type, and topology of the routers present.
3) The network addresses made available to the transport
layer should use a uniform numbering plan, even across
LANs and WANs.

• Given these goals, the problem centers on whether the


network layer should provide connection-oriented service
or connectionless service.
Implementation of Connectionless Service
ISP’s equipment

Routing within a datagram network


Implementation of Connection-Oriented Service

ISP’s equipment

A’s table C’s Table E’s Table

Routing within a virtual-circuit network


5.1.5 Comparison of VC and Datagram Subnets

5-4
5.2 Routing Algorithms
• The routing algorithm is that part of the network layer
software responsible for deciding which output line an
incoming packet should be transmitted on.
• If the subnet uses datagrams internally, this decision must
be made anew for every arriving data packet since the
best route may have changed since last time.
• If the subnet uses virtual circuits internally, routing
decisions are made only when a new virtual circuit is
being set up. Thereafter, data packets just follow the
previously-established route.
• The latter case is sometimes called session routing
because a route remains in force for an entire user
session.
5.2 Routing Algorithms (contd.)
• One can think of a router as having two processes inside it.
– One of them handles each packet as it arrives, looking
up the outgoing line to use for it in the routing tables.
This process is forwarding.
– The other process is responsible for filling in and
updating the routing tables. That is where the routing
algorithm comes into play.
• Certain properties are desirable in a routing algorithm:
– correctness,
– simplicity,
– robustness,
– stability,
– fairness, and
– optimality. (delay, throughput, or number of hops)
5.2 Routing Algorithms (contd.)
• Routing algorithms can be grouped into two classes:
nonadaptive and adaptive.
• Nonadaptive algorithms 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, and downloaded
to the routers when the network is booted. This is
sometimes called static routing.
• Adaptive algorithms, 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., when the
load or topology changes), and what metric is used for
optimization (e.g., distance, number of hops, or estimated
transit time).
5.2.2 Shortest Path Routing
• 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 (link).
• To choose a route between a given pair of routers, the
algorithm just finds the shortest path between them.
– One way of measuring path length is the number of hops. Using
this metric, the paths ABC and ABE in Fig. 5-7 are equally long.
– Another metric is the geographic distance in kilometers.
– A third metric could be the mean queueing 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.
– Generally, 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.
Shortest Path Routing

Figure 5.7: The first 5 steps used in computing the shortest path from
A to D. The arrows indicate the working node.
Distance Vector Routing

(a) A subnet (b) Input from A, I, H, K, & the new routing table for J
5.2.5 Link State Routing
• The idea behind link state routing is simple and can be
stated as five parts. Each router must do the following:

1) Discover its neighbors and learn their network addresses.


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.

• In effect, the complete topology and all delays are


experimentally measured and distributed to every router.
Then Dijkstra's algorithm can be run to find the shortest
path to every other router.
Learning about the Neighbors

Figure 5.11: (a) Nine routers and a LAN. (b) A graph model of (a).
Measuring Line Cost
• The link state routing algorithm requires each router to
know, or at least have a reasonable estimate of, the delay
to each of its neighbors.
• The most direct way to determine this delay is to send over
the line a special ECHO packet that the other side is
required to send back immediately. By measuring the
round-trip time and dividing it by two, the sending router
can get a reasonable estimate of the delay.
• An interesting issue is whether to take the load into account
when measuring the delay.
• To factor the load in, the round-trip timer must be started
when the ECHO packet is queued.
• To ignore the load, the timer should be started when the
ECHO packet reaches the front of the queue.
Building Link State Packets

Figure 5.13: (a) A subnet. (b) The link state packets for this subnet.
Distributing the Link State Packets

Figure 5.14: The packet buffer for router B in the previous slide (Fig. 5.13).
Congestion Control Algorithms

Figure 5.25: When too much traffic is offered, congestion


sets in and performance degrades sharply.
5.3 Congestion Control Algorithms (contd.)

• Congestion can be brought on by several


factors:

– Traffic greater than the network can cope with.

– Slow processors can also cause congestion.

– Low-bandwidth lines can also cause congestion.


Approaches to congestion control

Timescales of approaches to congestion control


Application Requirements

5-30

Figure 5.30: How stringent the quality-of-service requirements are.


Categories of QoS and Examples
• ATM networks classify flows in four broad
categories with respect to their QoS demands as
follows:
1) Constant bit rate (e.g., telephony).
2) Real-time variable bit rate (e.g., compressed
videoconferencing).
3) Non-real-time variable bit rate (e.g., watching a
movie over the Internet).
4) Available bit rate (e.g., file transfer).
Traffic Shaping (1)

(a) Shaping packets. (b) A leaky bucket. (c) A token bucket


Traffic Shaping (2)

(a) Traffic from a host. Output shaped by a token bucket of rate


200 Mbps and capacity (b) 9600 KB, (c) 0 KB.
Traffic Shaping (3)

Token bucket level for shaping with rate 200 Mbps and capacity
(d) 16000 KB, (e) 9600 KB, and (f) 0KB..
Packet Scheduling (1)
Kinds of resources can potentially be
reserved for different flows:

1. Bandwidth.
2. Buffer space.
3. CPU cycles.
Packet Scheduling (2)

Round-robin Fair Queuing


Packet Scheduling (3)

(a)Weighted Fair Queueing.


(b)Finishing times for the packets.
Admission Control (1)

An example flow specification


Admission Control (2)

Bandwidth and delay guarantees with token buckets and WFQ.


Integrated Services (1)

(a) A network. (b) The multicast spanning tree for host 1.


(c) The multicast spanning tree for host 2.
Integrated Services (2)

(a) Host 3 requests a channel to host 1.


(b) (b) Host 3 then requests a second channel, to host 2.
(c) Host 5 requests a channel to host 1.
Differentiated Services (1)

Expedited packets experience a traffic-free network


Differentiated Services (2)

A possible implementation of assured forwarding


Internetworking
• How networks differ
• How networks can be connected
• Tunneling
• Internetwork routing
• Packet fragmentation
5.5.1 How Networks Differ

5-43

Figure 5.43: Some of the many ways networks can differ.


5.5.2 How Networks Can Be Connected

(a) A packet crossing different networks.


(b) Network and link layer protocol processing.
5.5.7 Fragmentation
• Packet size issues:
1) Hardware (e.g., the size of an Ethernet frame).
2) Operating system (e.g., all buffers are 512 bytes).
3) Protocols (e.g., the number of bits in the packet
length field).
4) Compliance with some (inter)national standard.
5) Desire to reduce error-induced retransmissions to
some level.
6) Desire to prevent one packet from occupying the
channel too long.
5.5.7 Fragmentation (contd.)

Figure 5.50: (a) Transparent fragmentation. (b) Nontransparent fragmentation.


5.5.7 Fragmentation (contd.)

Figure 5.51: 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.
5.6 The Network Layer in the Internet
• We will now summarize what we consider to be the top
10 principles that drove Internet design in the past and
made it the success that it is today.

1) Make sure it works. Do not finalize the design or


standard until multiple prototypes have successfully
communicated with each other. All too often designers
first write a 1000-page standard, get it approved, then
discover it does not work. Then they write version 1.1 of
the standard. This is not the way to go.
2) Keep it simple. When in doubt, use the simplest
solution. If a feature is not absolutely essential,
leave it out, especially if the same effect can be
achieved by combining other features.
Design Principles for Internet
3) Make clear choices. If there are several ways of doing
the same thing, choose one. Standards often have
multiple options or modes or parameters because several
powerful parties insist that their way is best. Designers
should strongly resist this tendency. Just say no.
4) Exploit modularity. This principle leads directly to the
idea of having protocol stacks, each of whose layers is
independent of all others. In this way, if circumstances that
require one module or layer to be changed, the other ones
will not be affected.
5) Expect heterogeneity. Different types of hardware,
transmission facilities, and applications will occur on any
large network. To handle them, the network design must
be simple, general, and flexible.
6) Avoid static options and parameters. If parameters are
unavoidable, it is best to have the sender and receiver
negotiate a value than defining fixed choices.
Design Principles for Internet (contd.)
7) Look for a good design; it need not be perfect. Often
the designers have a good design but it cannot handle
some special cases. Rather than messing up the design,
the designers should go with the good design and put the
burden of working around it on the people with the
strange requirements.
8) Be strict when sending and tolerant when receiving.
In other words, only send packets that rigorously comply
with the standards, but expect incoming packets that may
not be fully conformant and try to deal with them.
9) Think about scalability. If the system is to handle
millions of hosts, no centralized databases of any kind are
tolerable and load must be spread as evenly as possible
over the available resources.
10) Consider performance and cost. If a network has poor
performance or outrageous costs, nobody will use it.
The Network Layer in the Internet (1)

• The IP Version 4 Protocol


• IP Addresses
• IP Version 6
• Internet Control Protocols
• Label Switching and MPLS
• OSPF—An Interior Gateway Routing Protocol
• BGP—The Exterior Gateway Routing Protocol
• Internet Multicasting
• Mobile IP
The Network Layer in the Internet (2)

Figure 5.52: The Internet is an interconnected collection of many networks.


The IP Version 4 Protocol (1)

Figure 5.53: The IPv4 (Internet Protocol) header.


The IP Version 4 Protocol (2)

5-54

Figure 5.54: Some of the IP options.


IP Addresses (1)

An IP prefix.
IP Addresses (2)

Splitting an IP prefix into separate networks with subnetting.


IP Addresses (3)

A set of IP address assignments


IP Addresses (4)

Aggregation of IP prefixes
IP Addresses (5)

Longest matching prefix routing at the New York router.


IP Addresses (6)

IP address formats
IP Addresses (7)

Figure 5.56: Special IP addresses.


IP Addresses (8)

Placement and operation of a NAT box.


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. . .
IP Version 6 (1)

The IPv6 fixed header (required).


IP Version 6 (2)

IPv6 extension headers


IP Version 6 (3)

The hop-by-hop extension header for large datagrams


(jumbograms).
IP Version 6 (4)

The extension header for routing.


Internet Control Protocols (1)

The principal ICMP message types.


Internet Control Protocols (2)

Two switched Ethernet LANs joined by a router


Label Switching and MPLS (1)

Transmitting a TCP segment using IP, MPLS, and PPP.


Label Switching and MPLS (2)

Forwarding an IP packet through an MPLS network


OSPF- An Interior Gateway Routing Protocol (1)

An autonomous system
OSPF- An Interior Gateway Routing Protocol (2)

A graph representation of the previous slide.


OSPF- An Interior Gateway Routing Protocol (3)

The relation between ASes, backbones, and areas in OSPF.


OSPF- An Interior Gateway Routing Protocol (4)

The five types of OSPF messages


BGP- The Exterior Gateway Routing Protocol (1)

Examples of routing constraints:


1. No commercial traffic for educat. network
2. Never put Iraq on route starting at Pentagon
3. Choose cheaper network
4. Choose better performing network
5. Don’t go from Apple to Google to Apple
BGP- The Exterior Gateway Routing Protocol (2)

Routing policies between four Autonomous Systems


BGP- The Exterior Gateway Routing Protocol (3)

Propagation of BGP route advertisements

S-ar putea să vă placă și