83
The Network Layer Muhammad Adil Raja Introduction Network Layer Design Issues Routing Algorithms Congestion Control Algorithms References T HE NETWORK L AYER Muhammad Adil Raja Roaming Researchers, Inc. August 29, 2014

The Network Layer

Embed Size (px)

DESCRIPTION

A presentation about the network layer of the OSI reference model.

Citation preview

Page 1: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

THE NETWORK LAYER

Muhammad Adil Raja

Roaming Researchers, Inc.

August 29, 2014

Page 2: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

OUTLINE

INTRODUCTION

NETWORK LAYER DESIGN ISSUES

ROUTING ALGORITHMS

CONGESTION CONTROL ALGORITHMS

REFERENCES

Page 3: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

OUTLINE

INTRODUCTION

NETWORK LAYER DESIGN ISSUES

ROUTING ALGORITHMS

CONGESTION CONTROL ALGORITHMS

REFERENCES

Page 4: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

OUTLINE

INTRODUCTION

NETWORK LAYER DESIGN ISSUES

ROUTING ALGORITHMS

CONGESTION CONTROL ALGORITHMS

REFERENCES

Page 5: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

OUTLINE

INTRODUCTION

NETWORK LAYER DESIGN ISSUES

ROUTING ALGORITHMS

CONGESTION CONTROL ALGORITHMS

REFERENCES

Page 6: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

OUTLINE

INTRODUCTION

NETWORK LAYER DESIGN ISSUES

ROUTING ALGORITHMS

CONGESTION CONTROL ALGORITHMS

REFERENCES

Page 7: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

INTRODUCTION I

I The network layer is concerned with getting packetsfrom the source all the way to the destination.

I Getting to the destination may require making manyhops at intermediate routers along the way.

I This function clearly contrasts with the function of thedata link layer.

I The data link layer is concerned with only movingframes from one end of a wire to the other.

I Thus, the network layer is the lowest layer that dealswith end-to-end transmission.

I To achieve its goals, the network layer must knowabout the topology of the network (i.e., the set of allrouters and links).

I It should also choose appropriate paths through thenetwork, even if it is large.

Page 8: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

INTRODUCTION II

I It must also take care when choosing routes to avoidoverloading some of the communication lines androutes while leaving others idle.

I It must also handle problems when source anddestination are in different networks.

I It is up to the network layer to deal with them.

Page 9: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DATA LINK LAYER DESIGN ISSUES I

I Network designers should grapple with certaindesign issues.

I These issues include the service provided to thetransport layer and the internal design of the network.

Page 10: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

STORE-AND-FORWARD PACKET SWITCHING IComponents of a computer network:

I Hosts (computers, handheld deveices etc.)I Switches.I Routers.I Wireless access points.

356 THE NETWORK LAYER CHAP. 5

5.1.1 Store-and-Forward Packet Switching

Before starting to explain the details of the network layer, it is worth restatingthe context in which the network layer protocols operate. This context can beseen in Fig. 5-1. The major components of the network are the ISP’s equipment(routers connected by transmission lines), shown inside the shaded oval, and thecustomers’ equipment, shown outside the oval. Host H1 is directly connected toone of the ISP’s routers, A, perhaps as a home computer that is plugged into aDSL modem. In contrast, H2 is on a LAN, which might be an office Ethernet,with a router, F, owned and operated by the customer. This router has a leasedline to the ISP’s equipment. We have shown F as being outside the oval becauseit does not belong to the ISP. For the purposes of this chapter, however, routerson customer premises are considered part of the ISP network because they run thesame algorithms as the ISP’s routers (and our main concern here is algorithms).

D

C

B

A E F

Packet

Process P1

Host H1

Router ISP’s equipment

H2LAN

P2

Figure 5-1. The environment of the network layer protocols.

This equipment is used as follows. A host with a packet to send transmits it tothe nearest router, either on its own LAN or over a point-to-point link to the ISP.The packet is stored there until it has fully arrived and the link has finished itsprocessing by verifying the checksum. Then it is forwarded to the next routeralong the path until it reaches the destination host, where it is delivered. Thismechanism is store-and-forward packet switching, as we have seen in previouschapters.

5.1.2 Services Provided to the Transport Layer

The network layer provides services to the transport layer at the networklayer/transport layer interface. An important question is precisely what kind ofservices the network layer provides to the transport layer. The services need to becarefully designed with the following goals in mind:

FIGURE: The environment of the network layer protocols.

Page 11: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

SERVICES PROVIDED TO THE TRANSPORT

LAYER I

I Network layer provides its services to the transportlayer at the network layer/transport layer interface.

I What kind of services the network layer provides tothe transport layer?

I The services need to be carefully designed with thefollowing goals in mind:

1. The services should be independent of the routertechnology.

2. The transport layer should be shielded from thenumber, type, and topology of the routers present.

3. The network addresses made available to thetransport layer should use a uniform numbering plan,even across LANs and WANs.

Page 12: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

SERVICES PROVIDED TO THE TRANSPORT

LAYER III These goals allow a lot of freedom to the network

layer designers in writing detailed specifications ofthe services to be offered to the transport layer.

I Conflicts of opinions arise among various factions ofdesigners.

I The debate centers on whether the network layershould provide conection oriented or connectionlessservice.

I Internet community argues that the routers’ job ismoving packets around and nothing else.

I In this view the network is inherently unreliable.I So the hosts should accept this fact and do error

control themselves.I It leads to the conclusion that the network service

should be connectionless.

Page 13: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

SERVICES PROVIDED TO THE TRANSPORT

LAYER IIII No packet ordering and flow control should be done,

as the hosts are going to do that anyway.I This reasoning is an example of the end-to-end

argument.I Moreover, each packet must carry the full destination

address, as each packet is carried independently ofits predecessors.

I ANother camp argues that the network shouldprovide a reliable, connection-oriented service.

I This camp is represented by the telephonecompanies.

I They view quality of service (QoS) as the dominantfactor.

I They view that QoS is difficult to achieve withoutconnections.

Page 14: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

IMPLEMENTATION OF CONNECTIONLESS

SERVICE I

I Packets are injected into the network individually androuted independently of each other.

I Any advance setup is not required.I Packets are called datagrams in this context (in

analogy with telegrams).I The network is called a datagram network.

Page 15: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

IMPLEMENTATION OF CONNECTIONLESS

SERVICE II

358 THE NETWORK LAYER CHAP. 5

5.1.3 Implementation of Connectionless Service

Having looked at the two classes of service the network layer can provide toits users, it is time to see how this layer works inside. Two different organizationsare possible, depending on the type of service offered. If connectionless service isoffered, packets are injected into the network individually and routed indepen-dently of each other. No advance setup is needed. In this context, the packets arefrequently called datagrams (in analogy with telegrams) and the network is call-ed a datagram network. If connection-oriented service is used, a path from thesource router all the way to the destination router must be established before anydata packets can be sent. This connection is called a VC (virtual circuit), in an-alogy with the physical circuits set up by the telephone system, and the network iscalled a virtual-circuit network. In this section, we will examine datagram net-works; in the next one, we will examine virtual-circuit networks.

Let us now see how a datagram network works. Suppose that the process P1in Fig. 5-2 has a long message for P2. It hands the message to the transport layer,with instructions to deliver it to process P2 on host H2. The transport layer coderuns on H1, typically within the operating system. It prepends a transport headerto the front of the message and hands the result to the network layer, probably justanother procedure within the operating system.

E’s tableC’s tableA’s table (initially) A’s table (later)

Dest. Line

D

C

B

A E F

Packet

Process P1

Host H1

Router ISP’s equipment

H2LAN

P2

4

23

1

AB B

C CD BE CF C

AB B

C CD BE BF B

AB A

A

C –D EE EF E

AB D

C

C CD DE –F F

Figure 5-2. Routing within a datagram network.

Let us assume for this example that the message is four times longer than themaximum packet size, so the network layer has to break it into four packets, 1, 2,

FIGURE: Routing within a datagram network.

Page 16: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

IMPLEMENTATION OF CONNECTION-ORIENTED

SERVICE I

I We require a virtual-circuit (VC) network.I The idea behind VCs is to avoid having to choose a

new route for every packet sent.I When a connection is established a route between

source and destination is chosen and stored withinthe tables inside the routers.

I That route is used for all traffic flowing over theconnection.

I This is exactly similar to the telephone system.I When the connection is released, VC is also

terminated.I With connection-oriented service, each packet

carries an identifier telling which virtual circuit itbelongs to.

Page 17: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

IMPLEMENTATION OF CONNECTION-ORIENTED

SERVICE II

360 THE NETWORK LAYER CHAP. 5

bearing connection identifier 1 comes in from H1, it is to be sent to router C andgiven connection identifier 1. Similarly, the first entry at C routes the packet to E,also with connection identifier 1.

A’s table

In Out

D

C

B

E F

Packet

Router ISP’s equipment

H2LAN

P2

24

3

1

H1H3 1

1

AProcess P1

Host H1

P3

H3

CC 2

1

C’s table

AA 2

1 EE 2

1

E’s table

CC 2

1 FF 2

1

Figure 5-3. Routing within a virtual-circuit network.

Now let us consider what happens if H3 also wants to establish a connectionto H2. It chooses connection identifier 1 (because it is initiating the connectionand this is its only connection) and tells the network to establish the virtual circuit.This leads to the second row in the tables. Note that we have a conflict here be-cause although A can easily distinguish connection 1 packets from H1 from con-nection 1 packets from H3, C cannot do this. For this reason, A assigns a differentconnection identifier to the outgoing traffic for the second connection. Avoidingconflicts of this kind is why routers need the ability to replace connection identi-fiers in outgoing packets.

In some contexts, this process is called label switching. An example of aconnection-oriented network service is MPLS (MultiProtocol Label Switching).It is used within ISP networks in the Internet, with IP packets wrapped in anMPLS header having a 20-bit connection identifier or label. MPLS is often hid-den from customers, with the ISP establishing long-term connections for largeamounts of traffic, but it is increasingly being used to help when quality of serviceis important but also with other ISP traffic management tasks. We will have moreto say about MPLS later in this chapter.

FIGURE: Routing within a virtual-circuit network.

Page 18: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

IMPLEMENTATION OF CONNECTION-ORIENTED

SERVICE III

I This is also called label switching.I An example is Multi Protocol Label Switching

(MPLS).

Page 19: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

COMPARISON OF VIRTUAL-CIRCUIT AND

DATAGRAM NETWORK I

SEC. 5.1 NETWORK LAYER DESIGN ISSUES 361

5.1.5 Comparison of Virtual-Circuit and Datagram Networks

Both virtual circuits and datagrams have their supporters and their detractors.We will now attempt to summarize both sets of arguments. The major issues arelisted in Fig. 5-4, although purists could probably find a counterexample foreverything in the figure.

Issue Datagram network Virtual-circuit network

Circuit setup Not needed Required

Addressing Each packet contains the fullsource and destination address

Each packet contains ashort VC number

State information Routers do not hold stateinformation about connections

Each VC requires routertable space per connection

Routing Each packet is routedindependently

Route chosen when VC isset up; all packets follow it

Effect of router failures None, except for packetslost during the crash

All VCs that passedthrough the failedrouter are terminated

Quality of service Difficult Easy if enough resourcescan be allocated inadvance for each VC

Congestion control Difficult Easy if enough resourcescan be allocated inadvance for each VC

Figure 5-4. Comparison of datagram and virtual-circuit networks.

Inside the network, several trade-offs exist between virtual circuits and data-grams. One trade-off is setup time versus address parsing time. Using virtual cir-cuits requires a setup phase, which takes time and consumes resources. However,once this price is paid, figuring out what to do with a data packet in a virtual-cir-cuit network is easy: the router just uses the circuit number to index into a table tofind out where the packet goes. In a datagram network, no setup is needed but amore complicated lookup procedure is required to locate the entry for the destina-tion.

A related issue is that the destination addresses used in datagram networks arelonger than circuit numbers used in virtual-circuit networks because they have aglobal meaning. If the packets tend to be fairly short, including a full destinationaddress in every packet may represent a significant amount of overhead, andhence a waste of bandwidth.

Yet another issue is the amount of table space required in router memory. Adatagram network needs to have an entry for every possible destination, whereas avirtual-circuit network just needs an entry for each virtual circuit. However, this

FIGURE: Comparison of datagram and virtual-circuit networks.

Page 20: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

COMPARISON OF VIRTUAL-CIRCUIT AND

DATAGRAM NETWORK II

Tradeoffs:I Setup time versus address parsing time.I Longer destination addresses in datagram networks

(overhead for smaller packets).I Table space required in router memory.

Page 21: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING ALGORITHMS I

I Routing packets from source to destination is themain function of the network layer.

I A routing algorithm decides which output line anincoming packet should be transmitted on.

I A new decision for every packet is required in adatagram network.

I A new decision is required only when a new virtualcircuit is being set up.

I It is important to distinguish between routing andforwarding.

I Forwarding is to look up the outgoing line to use for apacket (as it arrives) in a routing table.

I Routing is to fill in and update the routing tables.I Desirable properties of a routing algorithm:

1. Correctness.

Page 22: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING ALGORITHMS II

2. Simplicity.3. Robustness.4. Robustness.5. Stability.6. Fairness.7. Efficiency.

I Classification of Routing algorithms1. Adaptive algorithms – State routing.2. Nonadaptive algorithms – Dynamic routing.

Page 23: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING ALGORITHMS III364 THE NETWORK LAYER CHAP. 5

X X!

A B C

A' B' C'

Figure 5-5. Network with a conflict between fairness and efficiency.

measurements or estimates of the current topology and traffic. Instead, the choiceof the route to use to get from I to J (for all I and J) is computed in advance, off-line, and downloaded to the routers when the network is booted. This procedureis sometimes called static routing. Because it does not respond to failures, staticrouting is mostly useful for situations in which the routing choice is clear. For ex-ample, router F in Fig. 5-3 should send packets headed into the network to routerE regardless of the ultimate destination.

Adaptive algorithms, in contrast, change their routing decisions to reflectchanges in the topology, and sometimes changes in the traffic as well. Thesedynamic routing 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 topology changes, or every "T seconds as the load changes), andwhat metric is used for optimization (e.g., distance, number of hops, or estimatedtransit time).

In the following sections, we will discuss a variety of routing algorithms. Thealgorithms cover delivery models besides sending a packet from a source to adestination. Sometimes the goal is to send the packet to multiple, all, or one of aset of destinations. All of the routing algorithms we describe here make decisionsbased on the topology; we defer the possibility of decisions based on the trafficlevels to Sec 5.3.

5.2.1 The Optimality Principle

Before we get into specific algorithms, it may be helpful to note that one canmake a general statement about optimal routes without regard to network topo-logy or traffic. This statement is known as the optimality principle (Bellman,1957). It states that if router J is on the optimal path from router I to router K,

FIGURE: Network with a conflict between fairness andefficiency.

Page 24: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

THE OPTIMALITY PRINCIPLE I

I A statement about optimal routes without regard tonetwork topology.

I Directed Acyclic Graphs (DAG) – have no loops.

Page 25: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

SHORTEST PATH ALGORITHM I

Criteria:I Minimum number of hops.I Minimum geographic distance in kilometers.I End-to-end delay.I Bandwidth.I Average traffic.I Communication cost.I measured delay.

Page 26: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

SHORTEST PATH ALGORITHM IIDijkstra’s algorithm.

366 THE NETWORK LAYER CHAP. 5

5.2.2 Shortest Path Algorithm

Let us begin our study of routing algorithms with a simple technique for com-puting optimal paths given a complete picture of the network. These paths are theones that we want a distributed routing algorithm to find, even though not all rout-ers may know all of the details of the network.

The idea is to build a graph of the network, with each node of the graphrepresenting a router and each edge of the graph representing a communicationline, or link. To choose a route between a given pair of routers, the algorithm justfinds the shortest path between them on the graph.

The concept of a shortest path deserves some explanation. One way ofmeasuring path length is the number of hops. Using this metric, the paths ABCand ABE in Fig. 5-7 are equally long. Another metric is the geographic distancein kilometers, in which case ABC is clearly much longer than ABE (assuming thefigure is drawn to scale).

A D1

2

6

G

4

(a)

F (!, ") D (!,")

A

B 7 C

2

H

33

2

2 FE

1

22

6

G

4

A

(c)

A

B (2, A) C (9, B)

H (!, ")

E (4, B)

G (6, A)

F (6, E) D (!,")A

(e)

A

B (2, A) C (9, B)

H (9, G)

E (4, B)

G (5, E)

F (6,E) D (!,")A

(f)

A

B (2, A) C (9, B)

H (8, F)

E (4, B)

G (5, E)

F (6, E) D (!,1)A

(d)

A

B (2, A) C (9, B)

H (!, ")

E (4, B)

G (5, E)

F (!, ") D (!, ")A

H

E

G(b)

B (2, A) C (!, ")

H (!, ")

E (!, ")

G (6, A)

Figure 5-7. The first six steps used in computing the shortest path from A to D.The arrows indicate the working node.FIGURE: The first six steps used in computing the shortest path

from A to D. The arrows indicate the working node.

Page 27: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

FLOODING I

I In flooding every incoming packet is sent out onevery outgoing line except the one it arrived on.

I Generate vast number of duplicates packets.I It is robust but has computing and communication

overheads.

Page 28: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DISTANCE VECTOR ROUTING I

I Each router maintains a table (i.e., a vector).I It gives the best known distance to each destination

and which link to use to get there.I The tables are updated by exchanging information

with the neighbors.I Every router knows the best link to reach each

destination.I Each router maintains a routing table indexed by, and

containing one entry for each router in the network.I The entry has two parts:

1. The preferred outgoing line to use for thatdestination.

2. An estimate of the distance to that destination.

I The distance might be measured as the number ofhops or using another metric.

Page 29: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DISTANCE VECTOR ROUTING II

I The router is assumed to know the “distance” to eachof its neighbors.

I If the metric is hops, the distance is just one hop.I If the metric is propagation delay, the router can

measure it directly with special ECHO packets thatthe receiver just timestamps and sends back as fastas it can.

I Pseudonyms: Distributed Bellman-Ford routingalgorithm, RIP.

Page 30: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DISTANCE VECTOR ROUTING III

SEC. 5.2 ROUTING ALGORITHMS 371

router can measure it directly with special ECHO packets that the receiver justtimestamps and sends back as fast as it can.

As an example, assume that delay is used as a metric and that the routerknows the delay to each of its neighbors. Once every T msec, each router sends toeach neighbor a list of its estimated delays to each destination. It also receives asimilar list from each neighbor. Imagine that one of these tables has just come infrom neighbor X, with Xi being X’s estimate of how long it takes to get to router i.If the router knows that the delay to X is m msec, it also knows that it can reachrouter i via X in Xi + m msec. By performing this calculation for each neighbor, arouter can find out which estimate seems the best and use that estimate and thecorresponding link in its new routing table. Note that the old routing table is notused in the calculation.

This updating process is illustrated in Fig. 5-9. Part (a) shows a network. Thefirst four columns of part (b) show the delay vectors received from the neighborsof router J. A claims to have a 12-msec delay to B, a 25-msec delay to C, a 40-msec delay to D, etc. Suppose that J has measured or estimated its delay to itsneighbors, A, I, H, and K, as 8, 10, 12, and 6 msec, respectively.

(a)

A B C D

E

I J K L

F GH

Router

0122540142318172192429

2436182772031200112233

2031198301960147229

2128362422403119221009

8202820173018121006

15

AAIHIIHHI!

KK

To A I H K Line

New estimateddelay from J

ABCDEFGHIJKL

JA JI JH JKdelay delaydelaydelay

is is is is8 10 12 6

Newroutingtablefor J

Vectors received fromJ's four neighbors

(b)

Figure 5-9. (a) A network. (b) Input from A, I, H, K, and the new routing table for J.

Consider how J computes its new route to router G. It knows that it can get toA in 8 msec, and furthermore A claims to be able to get to G in 18 msec, so Jknows it can count on a delay of 26 msec to G if it forwards packets bound for G

FIGURE: (a) A network. (b) Input from A, I, H, K, and newrouting table for J.

Page 31: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DISTANCE VECTOR ROUTING IV

The Count-to-Infinity Problem:I The settling of routes to the best paths across the

network is called convergence.I Distance vector routing is useful as a simple

technique by which routers can collectively computeshortest paths.

I Split horizon with poisoned reverse.

Page 32: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

DISTANCE VECTOR ROUTING V

372 THE NETWORK LAYER CHAP. 5

to A. Similarly, it computes the delay to G via I, H, and K as 41 (31 + 10), 18(6 + 12), and 37 (31 + 6) msec, respectively. The best of these values is 18, so itmakes an entry in its routing table that the delay to G is 18 msec and that the routeto use is via H. The same calculation is performed for all the other destinations,with the new routing table shown in the last column of the figure.

The Count-to-Infinity Problem

The settling of routes to best paths across the network is called convergence .Distance vector routing is useful as a simple technique by which routers can col-lectively compute shortest paths, but it has a serious drawback in practice: al-though it converges to the correct answer, it may do so slowly. In particular, itreacts rapidly to good news, but leisurely to bad news. Consider a router whosebest route to destination X is long. If, on the next exchange, neighbor A suddenlyreports a short delay to X, the router just switches over to using the line to A tosend traffic to X. In one vector exchange, the good news is processed.

To see how fast good news propagates, consider the five-node (linear) net-work of Fig. 5-10, where the delay metric is the number of hops. Suppose A isdown initially and all the other routers know this. In other words, they have allrecorded the delay to A as infinity.

A B C D E

• • • •• • •

• ••4

1111

222

33

InitiallyAfter 1 exchangeAfter 2 exchangesAfter 3 exchangesAfter 4 exchanges

A B C D E

1 2 3 4

• • • •

2 3 43 4

46

3355

446

55

67 6 787 8 7

InitiallyAfter 1 exchangeAfter 2 exchangesAfter 3 exchangesAfter 4 exchangesAfter 5 exchangesAfter 6 exchanges

...

(a) (b)

Figure 5-10. The count-to-infinity problem.

When A comes up, the other routers learn about it via the vector exchanges.For simplicity, we will assume that there is a gigantic gong somewhere that isstruck periodically to initiate a vector exchange at all routers simultaneously. Atthe time of the first exchange, B learns that its left-hand neighbor has zero delayto A. B now makes an entry in its routing table indicating that A is one hop awayto the left. All the other routers still think that A is down. At this point, the rout-ing table entries for A are as shown in the second row of Fig. 5-10(a). On the next

FIGURE: The count-to-infinity problem.

Page 33: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING II Each router must do the following things to make it

work:1. Discover its neighbors and learn their network

addresses.2. Set the distance or cost metric to each of its

neighbors.3. Construct a packet telling all it has just learned.4. Send this packet to and receive packets from all

other routers.5. Compute the shortest path to every other router.

I In effect, the complete topology is distributed toevery router.

I The Dijkstra’s algorithm can be run at each router tofind the shortest path to every other router.

I Variants:1. IS-IS.2. OSPF.

I The five steps are discussed as follows:

Page 34: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING II

(1) Learning About the NeighborsI When a router is booted, its first task is to learn who

its neighbors are.I It accomplishes this goal by sending special HELLO

packet on each point-to-point line.I The router on the other end is expected to send back

a reply giving its name.I These names must be globally unique because

when a distant router later hears that three routersare all connected to F , it is essential that it candetermine whether all three mean the same F .

I When two or more routers are connected by abroadcast link (e.g., a switch, ring, or classicEthernet), the situation is slightly more complicated.

Page 35: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING III

374 THE NETWORK LAYER CHAP. 5

1. Discover its neighbors and learn their network addresses.

2. Set the distance or cost metric to each of its neighbors.

3. Construct a packet telling all it has just learned.

4. Send this packet to and receive packets from all other routers.

5. Compute the shortest path to every other router.

In effect, the complete topology is distributed to every router. Then Dijkstra’s al-gorithm can be run at each router to find the shortest path to every other router.Below we will consider each of these five steps in more detail.

Learning about the Neighbors

When a router is booted, its first task is to learn who its neighbors are. Itaccomplishes this goal by sending a special HELLO packet on each point-to-pointline. The router on the other end is expected to send back a reply giving its name.These names must be globally unique because when a distant router later hearsthat three routers are all connected to F, it is essential that it can determine wheth-er all three mean the same F.

When two or more routers are connected by a broadcast link (e.g., a switch,ring, or classic Ethernet), the situation is slightly more complicated. Fig. 5-11(a)illustrates a broadcast LAN to which three routers, A, C, and F, are directly con-nected. Each of these routers is connected to one or more additional routers, asshown.

Router

A

B

C

D E

C

D E

H

I

F

G G H

IF

N

A

B

LAN

(a) (b)

Figure 5-11. (a) Nine routers and a broadcast LAN. (b) A graph model of (a).

The broadcast LAN provides connectivity between each pair of attached rout-ers. However, modeling the LAN as many point-to-point links increases the size

FIGURE: (a) Nine routers and a broadcast LAN. (b) A graphmodel of (a).

Page 36: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING IV

(2) Setting Link CostsI The link state routing algorithm requires each link to

have a distance or cost metric for finding shortestpaths.

I The cost to reach neighbors can be setautomatically, or configured by the network operator.

I A common choice is to make the cost inverselyproportional to the bandwidth of the link.

I For example, 1-Gbps Ethernet may have a cost of 1and 100-Mbps Ethernet a cost of 10.

I This makes higher-capacity paths better choices.I If the network is geographically spread out, the delay

of the links may be factored into the cost so thatpaths over shorter links are better choices.

Page 37: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING V

I The most direct way to determine this delay is tosend over the line a special ECHO packet that theother side is required to send back immediately.

I By measuring the round-trip time and dividing it bytwo, the sending router can get a reasonableestimate of the delay.

Page 38: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING VIBuilding Link State packets

I Once the information needed for the exchange hasbeen collected, the next step is for each router tobuild a packet containing all the data.

I The packet starts with the identity of the sender,followed by a sequence number and age (to be de-scribed later) and a list of neighbors.

I The cost to each neighbor is also given.I Building the link state packets is easy.I The hard part is determining when to build them.I One possibility is to build them periodically, that is, at

regular intervals.I Another possibility is to build them when some

significant event occurs, such as a line or neighborgoing down or coming back up again or changing itsproperties appreciably.

Page 39: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING VII

SEC. 5.2 ROUTING ALGORITHMS 375

of the topology and leads to wasteful messages. A better way to model the LANis to consider it as a node itself, as shown in Fig. 5-11(b). Here, we have intro-duced a new, artificial node, N, to which A, C, and F are connected. One desig-nated router on the LAN is selected to play the role of N in the routing protocol.The fact that it is possible to go from A to C on the LAN is represented by thepath ANC here.

Setting Link Costs

The link state routing algorithm requires each link to have a distance or costmetric for finding shortest paths. The cost to reach neighbors can be set automat-ically, or configured by the network operator. A common choice is to make thecost inversely proportional to the bandwidth of the link. For example, 1-GbpsEthernet may have a cost of 1 and 100-Mbps Ethernet a cost of 10. This makeshigher-capacity paths better choices.

If the network is geographically spread out, the delay of the links may be fac-tored into the cost so that paths over shorter links are better choices. The mostdirect way to determine this delay is to send over the line a special ECHO packetthat the other side is required to send back immediately. By measuring theround-trip time and dividing it by two, the sending router can get a reasonableestimate of the delay.

Building Link State Packets

Once the information needed for the exchange has been collected, the nextstep is for each router to build a packet containing all the data. The packet startswith the identity of the sender, followed by a sequence number and age (to be de-scribed later) and a list of neighbors. The cost to each neighbor is also given. Anexample network is presented in Fig. 5-12(a) with costs shown as labels on thelines. The corresponding link state packets for all six routers are shown in Fig. 5-12(b).

B C

E F

A D61

2

8

5 7

4 3

(a)

ASeq.Age

B C D E F

B 4E 5

Seq.AgeA 4C 2

Seq.AgeB 2D 3

Seq.AgeC 3F 7

Seq.AgeA 5C 1

Seq.AgeB 6D 7

F 6 E 1 F 8 E 8

Link State Packets

(b)

Figure 5-12. (a) A network. (b) The link state packets for this network.FIGURE: ((a) A network. (b) The link state packets for thisnetwork.

Page 40: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING VIIIDistributing the Link State Packets

I The trickiest part of the algorithm is distributing thelink state packets.

I All of the routers must get all of the link state packetsquickly and reliably.

I If different routers are using different versions of thetopology, the routes they compute can haveinconsistencies such as loops, unreachablemachines, and other problems.

I The fundamental idea is to use flooding to distributethe link state packets to all routers.

I To keep the flood in check, each packet contains asequence number that is incremented for each newpacket sent.

I Routers keep track of all the (source router,sequence) pairs they see.

Page 41: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING IX

I When a new link state packet comes in, it is checkedagainst the list of packets already seen.

I If it is new, it is forwarded on all lines except the oneit arrived on.

I If it is a duplicate, it is discarded.I If a packet with a sequence number lower than the

highest one seen so far ever arrives, it is rejected asbeing obsolete as the router has more recent data.

Page 42: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING X

SEC. 5.2 ROUTING ALGORITHMS 377

compared. If they are equal, the duplicate is discarded. If they are different, theolder one is thrown out. To guard against errors on the links, all link state packetsare acknowledged.

The data structure used by router B for the network shown in Fig. 5-12(a) isdepicted in Fig. 5-13. Each row here corresponds to a recently arrived, but as yetnot fully processed, link state packet. The table records where the packet ori-ginated, its sequence number and age, and the data. In addition, there are sendand acknowledgement flags for each of B’s three links (to A, C, and F, re-spectively). The send flags mean that the packet must be sent on the indicatedlink. The acknowledgement flags mean that it must be acknowledged there.

D 21 59 1 0 0 0 1 1

C 20 60 1 0 1 0 1 0

E 21 59 0 1 0 1 0 1

F 21 60 1 1 0 0 0 1

A 21 60 0 1 1 1 0 0

Source Seq. Age A C F A C F Data

Send flags ACK flags

Figure 5-13. The packet buffer for router B in Fig. 5-12(a).

In Fig. 5-13, the link state packet from A arrives directly, so it must be sent toC and F and acknowledged to A, as indicated by the flag bits. Similarly, the pack-et from F has to be forwarded to A and C and acknowledged to F.

However, the situation with the third packet, from E, is different. It arrivestwice, once via EAB and once via EFB. Consequently, it has to be sent only to Cbut must be acknowledged to both A and F, as indicated by the bits.

If a duplicate arrives while the original is still in the buffer, bits have to bechanged. For example, if a copy of C’s state arrives from F before the fourthentry in the table has been forwarded, the six bits will be changed to 100011 to in-dicate that the packet must be acknowledged to F but not sent there.

Computing the New Routes

Once a router has accumulated a full set of link state packets, it can constructthe entire network graph because every link is represented. Every link is, in fact,represented twice, once for each direction. The different directions may evenhave different costs. The shortest-path computations may then find different pathsfrom router A to B than from router B to A.

Now Dijkstra’s algorithm can be run locally to construct the shortest paths toall possible destinations. The results of this algorithm tell the router which link to

FIGURE: The packet buffer for router B in FIGURE. 10 (a)

Page 43: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING XIComputing the New Routes

I Once a router has accumulated a full set of link statepackets, it can construct the entire network graphbecause every link is represented.

I Every link is, in fact, represented twice, once for eachdirection.

I The different directions may even have differentcosts.

I The shortest-path computations may then finddifferent paths from router A to B than from router Bto A.

I Now DijkstraÕs algorithm can be run locally toconstruct the shortest paths to all possibledestinations.

I The results of this algorithm tell the router which linkto use to reach each destination.

Page 44: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING XIII This information is installed in the routing tables, and

normal operation is resumed.I Compared to distance vector routing, link state

routing requires more memory and computation.I For a network with n routers, each of which has k

neighbors, the memory required to store the inputdata is proportional to kn, which is at least as largeas a routing table listing all the destinations.

I Also, the computation time grows faster than kn,even with the most efficient data structures, an issuein large networks.

I Nevertheless, in many practical situations, link staterouting works well because it does not suffer fromslow convergence problems.

I Link state routing is widely used in actual networks.

Page 45: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING XIIII Many ISPs use the IS-IS (Intermediate

System-Intermediate System) link state protocol.I OSPF (Open Shortest Path First) is the other main

link state protocol.I It was designed by IETF several years after IS-IS and

adopted many of the innovations designed for IS-IS.I These innovations include a self-stabilizing method

of flooding link state updates, the concept of adesignated router on a LAN, and the method ofcomputing and supporting path splitting and multiplemetrics.

I As a consequence, there is very little differencebetween IS-IS and OSPF.

I The most important difference is that IS-IS can carryinformation about multiple network layer protocols atthe same time (e.g., IP, IPX, and AppleTalk).

Page 46: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING XIV

I OSPF does not have this feature, and it is anadvantage in large multi-protocol environments.

I Link state, distance vector, and other algorithms relyon processing at all the routers to compute routes.

I Problems with the hardware or software at even asmall number of routers can wreak havoc across thenetwork. For example, if a router claims to have alink it does not have or forgets a link it does have, thenetwork graph will be incorrect.

I If a router fails to forward packets or corrupts themwhile forwarding them, the route will not work asexpected.

I Finally, if it runs out of memory or does the routingcalculation wrong, bad things will happen.

Page 47: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

LINK STATE ROUTING XV

I As the network grows into the range of tens orhundreds of thousands of nodes, the probability ofsome router failing occasionally becomesnon-negligible.

I The trick is to try to arrange to limit the damage whenthe inevitable happens.

Page 48: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

HIERARCHICAL ROUTING I

I As networks grow in size, the router routing tablesgrow proportionally.

I Not only is router memory consumed byever-increasing tables, but more CPU time is neededto scan them and more bandwidth is needed to sendstatus reports about them.

I At a certain point, the network may grow to the pointwhere it is no longer feasible for every router to havean entry for every other router, so the routing willhave to be done hierarchically, as it is in thetelephone network.

I When hierarchical routing is used, the routers aredivided into what we will call regions.

Page 49: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

HIERARCHICAL ROUTING III Each router knows all the details about how to route

packets to destinations within its own region butknows nothing about the internal structure of otherregions.

I When different networks are interconnected, it isnatural to regard each one as a separate region tofree the routers in one network from having to knowthe topological structure of the other ones.

I For huge networks, a two-level hierarchy may beinsufficient.

I It may be necessary to group the regions intoclusters, the clusters into zones, the zones intogroups, and so on.

I As an example of a multilevel hierarchy, considerhow a packet might be routed from Berkeley,California, to Malindi, Kenya.

Page 50: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

HIERARCHICAL ROUTING III

I The Berkeley router would know the detailedtopology within California but would send allout-of-state traffic to the Los Angeles router.

I The Los Angeles router would be able to route trafficdirectly to other domestic routers but would send allforeign traffic to New York.

I The New York router would be programmed to directall traffic to the router in the destination countryresponsible for handling foreign traffic, say, in Nairobi.

I Finally, the packet would work its way down the treein Kenya until it got to Malindi.

I When a single network becomes very large, aninteresting question is “how many levels should thehierarchy have?”

I consider a network with 720 routers.

Page 51: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

HIERARCHICAL ROUTING IV

I If there is no hierarchy, each router needs 720routing table entries.

I If the network is partitioned into 24 regions of 30routers each, each router needs 30 local entries plus23 remote entries for a total of 53 entries.

I If a three-level hierarchy is chosen, with 8 clusterseach containing 9 regions of 10 routers.

I Each router needs 10 entries for local routers, 8entries for routing to other regions within its owncluster, and 7 entries for distant clusters, for a total of25 entries.

Page 52: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

HIERARCHICAL ROUTING V380 THE NETWORK LAYER CHAP. 5

Region 1 Region 2

Region 3 Region 5Region 4

1B

1A1C

2A 2B

2C

5B 5C5A

5E5D

2D

4A

4B 4C

3A

3B

1B 11C 11B 21B 31B 31B 41C 31C 21C 31C 41C 41C 41C 51B 51C 61C 5

– –1A

1C2A2B2C2D3A3B4A4B4C5A5B5C5D5E

1B

Line HopsDest.

Full table for 1A

1A

1C2345

1B

Line HopsDest.

Hierarchical table for 1A

1B 11C 11B 21C 21C 31C 4

– –

(a) (b) (c)

Figure 5-14. Hierarchical routing.

5.2.7 Broadcast Routing

In some applications, hosts need to send messages to many or all other hosts.For example, a service distributing weather reports, stock market updates, or liveradio programs might work best by sending to all machines and letting those thatare interested read the data. Sending a packet to all destinations simultaneously iscalled broadcasting. Various methods have been proposed for doing it.

One broadcasting method that requires no special features from the network isfor the source to simply send a distinct packet to each destination. Not only is themethod wasteful of bandwidth and slow, but it also requires the source to have acomplete list of all destinations. This method is not desirable in practice, eventhough it is widely applicable.

An improvement is multidestination routing, in which each packet containseither a list of destinations or a bit map indicating the desired destinations. Whena packet arrives at a router, the router checks all the destinations to determine theset of output lines that will be needed. (An output line is needed if it is the bestroute to at least one of the destinations.) The router generates a new copy of thepacket for each output line to be used and includes in each packet only those dest-inations that are to use the line. In effect, the destination set is partitioned among

FIGURE: Hierarchical routing

Page 53: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

BROADCASTING ROUTING I

I When messages need to be sent to many or all otherhosts.

I Multidestination routing.I Reverse path forwarding.

SEC. 5.2 ROUTING ALGORITHMS 381

the output lines. After a sufficient number of hops, each packet will carry onlyone destination like a normal packet. Multidestination routing is like using sepa-rately addressed packets, except that when several packets must follow the sameroute, one of them pays full fare and the rest ride free. The network bandwidth istherefore used more efficiently. However, this scheme still requires the source toknow all the destinations, plus it is as much work for a router to determine whereto send one multidestination packet as it is for multiple distinct packets.

We have already seen a better broadcast routing technique: flooding. Whenimplemented with a sequence number per source, flooding uses links efficientlywith a decision rule at routers that is relatively simple. Although flooding is ill-suited for ordinary point-to-point communication, it rates serious consideration forbroadcasting. However, it turns out that we can do better still once the shortestpath routes for regular packets have been computed.

The idea for reverse path forwarding is elegant and remarkably simple onceit has been pointed out (Dalal and Metcalfe, 1978). When a broadcast packet ar-rives at a router, the router checks to see if the packet arrived on the link that isnormally used for sending packets toward the source of the broadcast. If so, thereis an excellent chance that the broadcast packet itself followed the best route fromthe router and is therefore the first copy to arrive at the router. This being thecase, the router forwards copies of it onto all links except the one it arrived on. If,however, the broadcast packet arrived on a link other than the preferred one forreaching the source, the packet is discarded as a likely duplicate.

I

F H J N

A D GKE O M O

GC D N

BH L

L B

A

E

H

B CD

F

J

G

O

MK

LN

I

(a)

AB C

D

G

J

O

FI

E

H

K

L

M

N

(b) (c)

KE

H

Figure 5-15. Reverse path forwarding. (a) A network. (b) A sink tree. (c) Thetree built by reverse path forwarding.

An example of reverse path forwarding is shown in Fig. 5-15. Part (a) showsa network, part (b) shows a sink tree for router I of that network, and part (c)shows how the reverse path algorithm works. On the first hop, I sends packets toF, H, J, and N, as indicated by the second row of the tree. Each of these packetsarrives on the preferred path to I (assuming that the preferred path falls along thesink tree) and is so indicated by a circle around the letter. On the second hop,

FIGURE: Reverse path forwarding. (a) A network. (b) A sinktree. (c) The tree built by reverse path forwarding.

Page 54: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

MULTICAST ROUTING II Sending messages to a selected group of hosts.I Multicast OSPF (MOSF).I Distance Vector Multicast Routing Protocol

(DVMRP).I Protocol Independent Multicast (PIM).

384 THE NETWORK LAYER CHAP. 5

1, 2

1

1, 2

2 1 12

2

1

2

1, 21, 2

2 2

1

1

11

11

1

2

2

2

2 2

(a) (b)

(c) (d)

Figure 5-16. (a) A network. (b) A spanning tree for the leftmost router. (c) Amulticast tree for group 1. (d) A multicast tree for group 2.

has n groups, each with an average of m nodes. At each router and for eachgroup, m pruned spanning trees must be stored, for a total of mn trees. For exam-ple, Fig. 5-16(c) gives the spanning tree for the leftmost router to send to group 1.The spanning tree for the rightmost router to send to group 1 (not shown) willlook quite different, as packets will head directly for group members rather thanvia the left side of the graph. This in turn means that routers must forward pack-ets destined to group 1 in different directions depending on which node is sendingto the group. When many large groups with many senders exist, considerablestorage is needed to store all the trees.

An alternative design uses core-based trees to compute a single spanning treefor the group (Ballardie et al., 1993). All of the routers agree on a root (called thecore or rendezvous point) and build the tree by sending a packet from eachmember to the root. The tree is the union of the paths traced by these packets.Fig. 5-17(a) shows a core-based tree for group 1. To send to this group, a sendersends a packet to the core. When the packet reaches the core, it is forwarded downthe tree. This is shown in Fig. 5-17(b) for the sender on the righthand side of thenetwork. As a performance optimization, packets destined for the group do notneed to reach the core before they are multicast. As soon as a packet reaches the

Page 55: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

MULTICAST ROUTING II

FIGURE: (a) A network. (b) A spanning tree for the leftmostrouter. (c) A multicast tree for group 1. (d) A multicast tree forgroup 2.

Page 56: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ANYCAST ROUTING I

I A packet is delivered to the nearest member of agroup.

386 THE NETWORK LAYER CHAP. 5

we want to anycast to the members of group 1. They will all be given the address‘‘1,’’ instead of different addresses. Distance vector routing will distribute vectorsas usual, and nodes will choose the shortest path to destination 1. This will resultin nodes sending to the nearest instance of destination 1. The routes are shown inFig. 5-18(a). This procedure works because the routing protocol does not realizethat there are multiple instances of destination 1. That is, it believes that all theinstances of node 1 are the same node, as in the topology shown in Fig. 5-18(b).

1

11

1

1

1

(a) (b)

Figure 5-18. (a) Anycast routes to group 1. (b) Topology seen by the routing protocol.

This procedure works for link state routing as well, although there is theadded consideration that the routing protocol must not find seemingly short pathsthat pass through node 1. This would result in jumps through hyperspace, sincethe instances of node 1 are really nodes located in different parts of the network.However, link state protocols already make this distinction between routers andhosts. We glossed over this fact earlier because it was not needed for our dis-cussion.

5.2.10 Routing for Mobile Hosts

Millions of people use computers while on the go, from truly mobile situa-tions with wireless devices in moving cars, to nomadic situations in which laptopcomputers are used in a series of different locations. We will use the term mobilehosts to mean either category, as distinct from stationary hosts that never move.Increasingly, people want to stay connected wherever in the world they may be, aseasily as if they were at home. These mobile hosts introduce a new complication:to route a packet to a mobile host, the network first has to find it.

The model of the world that we will consider is one in which all hosts are as-sumed to have a permanent home location that never changes. Each hosts alsohas a permanent home address that can be used to determine its home location,analogous to the way the telephone number 1-212-5551212 indicates the UnitedStates (country code 1) and Manhattan (212). The routing goal in systems with

FIGURE: (a) Anycast routes to group 1. (b) Topology seen bythe routing protocol.

Page 57: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING FOR MOBILE HOSTS I

I The basic idea used for mobile routing in the Internetand cellular networks is for the mobile host to tell ahost at the home location where it is now.

I This host, which acts on behalf of the mobile host, iscalled the home agent.

I Once it knows where the mobile host is currentlylocated, it can forward packets so that they aredelivered.

Page 58: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING FOR MOBILE HOSTS II388 THE NETWORK LAYER CHAP. 5

Mobile host atcare of address

3: Tunnel to care of address1: Register care of address

2: Send to home address

Home agent athome address

Sender4: Replyto sender5: Tunnel

to care ofaddress

Figure 5-19. Packet routing for mobile hosts.

When the encapsulated packet arrives at the care of address, the mobile hostunwraps it and retrieves the packet from the sender. The mobile host then sendsits reply packet directly to the sender (step 4). The overall route is called trianglerouting because it may be circuitous if the remote location is far from the homelocation. As part of step 4, the sender may learn the current care of address. Sub-sequent packets can be routed directly to the mobile host by tunneling them to thecare of address (step 5), bypassing the home location entirely. If connectivity islost for any reason as the mobile moves, the home address can always be used toreach the mobile.

An important aspect that we have omitted from this description is security. Ingeneral, when a host or router gets a message of the form ‘‘Starting right now,please send all of Stephany’s mail to me,’’ it might have a couple of questionsabout whom it is talking to and whether this is a good idea. Security informationis included in the messages so that their validity can be checked with crypto-graphic protocols that we will study in Chap. 8.

There are many variations on mobile routing. The scheme above is modeledon IPv6 mobility, the form of mobility used in the Internet (Johnson et al., 2004)and as part of IP-based cellular networks such as UMTS. We showed the senderto be a stationary node for simplicity, but the designs let both nodes be mobilehosts. Alternatively, the host may be part of a mobile network, for example acomputer in a plane. Extensions of the basic scheme support mobile networkswith no work on the part of the hosts (Devarapalli et al., 2005).

Some schemes make use of a foreign (i.e., remote) agent, similar to the homeagent but at the foreign location, or analogous to the VLR (Visitor Location Reg-ister) in cellular networks. However, in more recent schemes, the foreign agent isnot needed; mobile hosts act as their own foreign agents. In either case, know-ledge of the temporary location of the mobile host is limited to a small number of

FIGURE: Packet routing for mobile hosts.

Page 59: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING IN AD HOC NETWORKS I

I MANETs (Mobile Ad hoc NETworks).I AODV (Adhoc On-demand Distance Vector).I Route discovery.I Route maintenance.

390 THE NETWORK LAYER CHAP. 5

more complicated, with buildings, hills, and other obstacles that block communi-cation, and nodes for which A is connected to B but B is not connected to A be-cause A has a more powerful transmitter than B. However, for simplicity, we willassume all connections are symmetric.

To describe the algorithm, consider the newly formed ad hoc network ofFig. 5-20. Suppose that a process at node A wants to send a packet to node I. TheAODV algorithm maintains a distance vector table at each node, keyed by desti-nation, giving information about that destination, including the neighbor to whichto send packets to reach the destination. First, A looks in its table and does notfind an entry for I. It now has to discover a route to I. This property of discover-ing routes only when they are needed is what makes this algorithm ‘‘on demand.’’

A B C

Range ofA’s broadcast

A

D

B C

EF F

H I H I

G G

E ED D

C CB BA A

G

IH

F

DE

G

IH

(a) (b) (c) (d)

F

Figure 5-20. (a) Range of A’s broadcast. (b) After B and D receive it. (c) AfterC, F, and G receive it. (d) After E, H, and I receive it. The shaded nodes arenew recipients. The dashed lines show possible reverse routes. The solid linesshow the discovered route.

To locate I, A constructs a ROUTE REQUEST packet and broadcasts it usingflooding, as described in Sec. 5.2.3. The transmission from A reaches B and D, asillustrated in Fig. 5-20(a). Each node rebroadcasts the request, which continues toreach nodes F, G, and C in Fig. 5-20(c) and nodes H, E, and I in Fig. 5-20(d). Asequence number set at the source is used to weed out duplicates during the flood.For example, D discards the transmission from B in Fig. 5-20(c) because it has al-ready forwarded the request.

Eventually, the request reaches node I, which constructs a ROUTE REPLYpacket. This packet is unicast to the sender along the reverse of the path followedby the request. For this to work, each intermediate node must remember the nodethat sent it the request. The arrows in Fig. 5-20(b)–(d) show the reverse routeinformation that is stored. Each intermediate node also increments a hop count asit forwards the reply. This tells the nodes how far they are from the destination.The replies tell each intermediate node which neighbor to use to reach the destina-tion: it is the node that sent them the reply. Intermediate nodes G and D put the

FIGURE: ((a) Range of AÕs broadcast. (b) After B and Dreceive it. (c) After C, F, and G receive it. (d) After E, H, and I

Page 60: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

ROUTING IN AD HOC NETWORKS II

receive it. The shaded nodes are new recipients. The dashedlines show possible reverse routes. The solid lines show thediscovered route.

Page 61: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS I

I Too many packets present in (a part of) the networkcauses packet delay and loss that degradesperformance.

I This situation is called congestion.I The network and transport layers share the

responsibility for handling congestion.I Since congestion occurs within the network, it is the

network layer that directly experiences it and mustultimately determine what to do with the excesspackets.

I However, the most effective way to controlcongestion is to reduce the load that the transportlayer is placing on the network.

I This requires the network and transport layers towork together.

Page 62: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS III This chapter looks at the network aspects of

congestion.I When the number of packets hosts send into the

network is well within its carrying capacity, thenumber delivered is proportional to the number sent.

I If twice as many are sent, twice as many aredelivered.

I However, as the offered load approaches thecarrying capacity, bursts of traffic occasionally fill upthe buffers inside routers and some packets are lost.

I These lost packets consume some of the capacity,so the number of delivered packets falls below theideal curve.

I The network is now congested.I Unless the network is well designed, it may

experience a congestion collapse.

Page 63: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS III

I In this situation performance plummets as the offeredload increases beyond the capacity.

I This can happen because packets can be sufficientlydelayed inside the network that they are no longeruseful when they leave the network.

I Unfortunately, congestion cannot wholly be avoided.I If all of a sudden, streams of packets begin arriving

on three or four input lines and all need the sameoutput line, a queue will build up.

I If there is insufficient memory to hold all of them,packets will be lost.

I Adding more memory may help up to a point, butNagle (1987) realized that if routers have an infiniteamount of memory, congestion gets worse, notbetter.

Page 64: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS IV

I This is because by the time packets get to the frontof the queue, they have already timed out(repeatedly) and duplicates have been sent.

I This makes matters worse, not better – it leads tocongestion collapse.

I Low-bandwidth links or routers that process packetsmore slowly than the line rate can also becomecongested.

I In this case, the situation can be improved bydirecting some of the traffic away from the bottleneckto other parts of the network.

I Eventually, however, all regions of the network will becongested.

I In this situation, there is no alternative but to shedload or build a faster network.

Page 65: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS V

I It is worth pointing out the difference betweencongestion control and flow control, as therelationship is a very subtle one.

I Congestion control has to do with making sure thenetwork is able to carry the offered traffic.

I It is a global issue, involving the behavior of all thehosts and routers.

I Flow control, in contrast, relates to the trafficbetween a particular sender and a particular receiver.

I Its job is to make sure that a fast sender cannotcontinually transmit data faster than the receiver isable to absorb it.

Page 66: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS VI

I To see the difference between these two concepts,consider a network made up of 100-Gbps fiber opticlinks on which a supercomputer is trying to force feeda large file to a personal computer that is capable ofhandling only 1 Gbps.

I Although there is no congestion (the network itself isnot in trouble), flow control is needed to force thesupercomputer to stop frequently to give thepersonal computer a chance to breathe.

I At the other extreme, consider a network with 1-Mbpslines and 1000 large computers, half of which aretrying to transfer files at 100 kbps to the other half.

I Here, the problem is not that of fast sendersoverpowering slow receivers, but that the totaloffered traffic exceeds what the network can handle.

Page 67: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS VIII The reason congestion control and flow control are

often confused is that the best way to handle bothproblems is to get the host to slow down.

I Thus, a host can get a “slow down” message eitherbecause the receiver cannot handle the load orbecause the network cannot handle it.

I Congestion Collapse: Performance plummets asthe offered load increases beyond the capacity.

I If routers have an infinite amount of memory,congestion gets worse not better.

I This is because by the time packets get to the frontof the queue, they have already timed out(repeatedly) and duplicates have been sent.

I This makes matters worse, not better – it leads tocongestion collapse.

Page 68: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS VIII

I It is important to differentiate between congestioncontrol and flow control.

I Congestion control has to do with making sure thenetwork is able to carry the offered traffic.

I It is a global issue, involving the behavior of all thehosts and routers.

I Flow control, in contrast, relates to the trafficbetween a particular sender and a particular receiver.

I Its job is to make sure that a fast sender cannotcontinually transmit data faster than the receiver isable to absorb it.

Page 69: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

CONGESTION CONTROL ALGORITHMS IXSEC. 5.3 CONGESTION CONTROL ALGORITHMS 393

Ideal

Goo

dput

(pac

kets

/sec

)

Desirableresponse

Capacity ofthe network

Congestioncollapse

Offered load (packet/sec)

Onset ofcongestion

Figure 5-21. With too much traffic, performance drops sharply.

Unless the network is well designed, it may experience a congestion collapse,in which performance plummets as the offered load increases beyond the capaci-ty. This can happen because packets can be sufficiently delayed inside the net-work that they are no longer useful when they leave the network. For example, inthe early Internet, the time a packet spent waiting for a backlog of packets aheadof it to be sent over a slow 56-kbps link could reach the maximum time it was al-lowed to remain in the network. It then had to be thrown away. A different failuremode occurs when senders retransmit packets that are greatly delayed, thinkingthat they have been lost. In this case, copies of the same packet will be deliveredby the network, again wasting its capacity. To capture these factors, the y-axis ofFig. 5-21 is given as goodput, which is the rate at which useful packets are deliv-ered by the network.

We would like to design networks that avoid congestion where possible anddo not suffer from congestion collapse if they do become congested. Unfortunate-ly, congestion cannot wholly be avoided. If all of a sudden, streams of packetsbegin arriving on three or four input lines and all need the same output line, aqueue will build up. If there is insufficient memory to hold all of them, packetswill be lost. Adding more memory may help up to a point, but Nagle (1987) real-ized that if routers have an infinite amount of memory, congestion gets worse, notbetter. This is because by the time packets get to the front of the queue, they havealready timed out (repeatedly) and duplicates have been sent. This makes mattersworse, not better—it leads to congestion collapse.

Low-bandwidth links or routers that process packets more slowly than the linerate can also become congested. In this case, the situation can be improved bydirecting some of the traffic away from the bottleneck to other parts of the net-work. Eventually, however, all regions of the network will be congested. In thissituation, there is no alternative but to shed load or build a faster network.

It is worth pointing out the difference between congestion control and flowcontrol, as the relationship is a very subtle one. Congestion control has to do with

FIGURE: With too much traffic, performance drops sharply.

Page 70: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL I

I The presence of congestion means that the load is(temporarily) greater than the resources (in a part ofthe network) can handle.

I Two solutions come to mind: increase the resourcesor decrease the load.

I As shown in Fig. 19, these solutions are usuallyapplied on different time scales to either preventcongestion or react to it once it has occurred.

394 THE NETWORK LAYER CHAP. 5

making sure the network is able to carry the offered traffic. It is a global issue, in-volving the behavior of all the hosts and routers. Flow control, in contrast, relatesto the traffic between a particular sender and a particular receiver. Its job is tomake sure that a fast sender cannot continually transmit data faster than the re-ceiver is able to absorb it.

To see the difference between these two concepts, consider a network madeup of 100-Gbps fiber optic links on which a supercomputer is trying to force feeda large file to a personal computer that is capable of handling only 1 Gbps. Al-though there is no congestion (the network itself is not in trouble), flow control isneeded to force the supercomputer to stop frequently to give the personal com-puter a chance to breathe.

At the other extreme, consider a network with 1-Mbps lines and 1000 largecomputers, 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 thatthe total offered traffic exceeds what the network can handle.

The reason congestion control and flow control are often confused is that thebest way to handle both problems is to get the host to slow down. Thus, a hostcan get a ‘‘slow down’’ message either because the receiver cannot handle theload or because the network cannot handle it. We will come back to this point inChap. 6.

We will start our study of congestion control by looking at the approaches thatcan be used at different time scales. Then we will look at approaches to pre-venting congestion from occurring in the first place, followed by approaches forcoping with it once it has set in.

5.3.1 Approaches to Congestion Control

The presence of congestion means that the load is (temporarily) greater thanthe resources (in a part of the network) can handle. Two solutions come to mind:increase the resources or decrease the load. As shown in Fig. 5-22, these solu-tions are usually applied on different time scales to either prevent congestion orreact to it once it has occurred.

Traffic-awarerouting

Networkprovisioning

Trafficthrottling

Admissioncontrol

Loadshedding

Slower(Preventative)

Faster(Reactive)

Figure 5-22. Timescales of approaches to congestion control.

The most basic way to avoid congestion is to build a network that is wellmatched to the traffic that it carries. If there is a low-bandwidth link on the pathalong which most traffic is directed, congestion is likely. Sometimes resources

FIGURE: Timescales of approaches to congestion control.

Page 71: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL III The most basic way to avoid congestion is to build a

network that is well matched to the traffic that itcarries.

I If there is a low-bandwidth link on the path alongwhich most traffic is directed, congestion is likely.

I Sometimes resources can be added dynamicallywhen there is serious congestion, for example,turning on spare routers or enabling lines that arenormally used only as backups (to make the systemfault tolerant) or purchasing bandwidth on the openmarket.

I More often, links and routers that are regularlyheavily utilized are upgraded at the earliestopportunity.

I This is called provisioning and happens on a timescale of months, driven by long-term traffic trends.

Page 72: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL IIII To make the most of the existing network capacity,

routes can be tailored to traffic patterns that changeduring the day as network users wake and sleep indifferent time zones.

I For example, routes may be changed to shift trafficaway from heavily used paths by changing theshortest path weights.

I Some local radio stations have helicopters flyingaround their cities to report on road congestion tomake it possible for their mobile listeners to routetheir packets (cars) around hotspots.

I This is called traffic-aware routing.I Splitting traffic across multiple paths is also helpful.I However, sometimes it is not possible to increase

capacity.

Page 73: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL IVI The only way then to beat back the congestion is to

decrease the load.I In a virtual-circuit network, new connections can be

refused if they would cause the network to becomecongested.

I This is called admission control.I At a finer granularity, when congestion is imminent

the network can deliver feedback to the sourceswhose traffic flows are responsible for the problem.

I The network can request these sources to throttletheir traffic, or it can slow down the traffic itself.

I Two difficulties with this approach are how to identifythe onset of congestion, and how to inform thesource that needs to slow down.

I To tackle the first issue, routers can monitor theaverage load, queueing delay, or packet loss.

Page 74: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL VI In all cases, rising numbers indicate growing

congestion.I To tackle the second issue, routers must participate

in a feedback loop with the sources.I For a scheme to work correctly, the time scale must

be adjusted carefully.I If every time two packets arrive in a row, a router

yells STOP and every time a router is idle for 20?sec, it yells GO, the system will oscillate wildly andnever converge.

I On the other hand, if it waits 30 minutes to makesure before saying anything, the congestion-controlmechanism will react too sluggishly to be of any use.

I Delivering timely feedback is a nontrivial matter.I An added concern is having routers send more

messages when the network is already congested.

Page 75: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

APPROACHES TO CONGESTION CONTROL VI

I Finally, when all else fails, the network is forced todiscard packets that it cannot deliver.

I The general name for this is load shedding.I A good policy for choosing which packets to discard

can help to prevent congestion collapse.

Page 76: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

QUALITY OF SERVICE (QOS) I

I One of the ways to provide QoS is to over-provisionthe network.

I Four issues must be addressed to ensure quality ofservice:

1. What applications need from the network –Application requirements.

2. How to regulate the traffic that enters the network –traffic shaping.

3. How to reserve resources at routers to guaranteeperformance – traffic scheduling.

4. Whether the network can safely accept more traffic –admission control.

I Integrate services.I RSVP – The resource reservation protocol.I Differentiated services.

Page 77: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

QUALITY OF SERVICE (QOS) II

SEC. 5.4 QUALITY OF SERVICE 405

No single technique deals efficiently with all these issues. Instead, a variety oftechniques have been developed for use at the network (and transport) layer.Practical quality-of-service solutions combine multiple techniques. To this end,we will describe two versions of quality of service for the Internet calledIntegrated Services and Differentiated Services.

5.4.1 Application Requirements

A stream of packets from a source to a destination is called a flow (Clark,1988). A flow might be all the packets of a connection in a connection-orientednetwork, or all the packets sent from one process to another process in a con-nectionless network. The needs of each flow can be characterized by four pri-mary parameters: bandwidth, delay, jitter, and loss. Together, these determine theQoS (Quality of Service) the flow requires.

Several common applications and the stringency of their network re-quirements are listed in Fig. 5-27. Note that network requirements are less de-manding than application requirements in those cases that the application can im-prove on the service provided by the network. In particular, networks do not needto be lossless for reliable file transfer, and they do not need to deliver packets withidentical delays for audio and video playout. Some amount of loss can be repairedwith retransmissions, and some amount of jitter can be smoothed by bufferingpackets at the receiver. However, there is nothing applications can do to remedythe situation if the network provides too little bandwidth or too much delay.

Application Bandwidth Delay Jitter Loss

Email Low Low Low Medium

File sharing High Low Low Medium

Web access Medium Medium Low Medium

Remote login Low Medium Medium Medium

Audio on demand Low Low High Low

Video on demand High Low High Low

Telephony Low High High Low

Videoconferencing High High High Low

Figure 5-27. Stringency of applications’ quality-of-service requirements.

The applications differ in their bandwidth needs, with email, audio in allforms, and remote login not needing much, but file sharing and video in all formsneeding a great deal.

More interesting are the delay requirements. File transfer applications, in-cluding email and video, are not delay sensitive. If all packets are delayed uni-formly by a few seconds, no harm is done. Interactive applications, such as Web

FIGURE: Stringency of applications’ quality-of-servicerequirements.

Page 78: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

QUALITY OF SERVICE (QOS) III

408 THE NETWORK LAYER CHAP. 5

Try to imagine a bucket with a small hole in the bottom, as illustrated inFig. 5-28(b). No matter the rate at which water enters the bucket, the outflow is ata constant rate, R, when there is any water in the bucket and zero when the bucketis empty. Also, once the bucket is full to capacity B, any additional water enter-ing it spills over the sides and is lost.

Checkbuckethere

Host

PacketsRate

R

B

B

RateR

Take outwater/tokens

Put inwater

Network

(a) (b) (c)

Figure 5-28. (a) Shaping packets. (b) A leaky bucket. (c) A token bucket.

This bucket can be used to shape or police packets entering the network, asshown in Fig. 5-28(a). Conceptually, each host is connected to the network by aninterface containing a leaky bucket. To send a packet into the network, it must bepossible to put more water into the bucket. If a packet arrives when the bucket isfull, the packet must either be queued until enough water leaks out to hold it or bediscarded. The former might happen at a host shaping its traffic for the networkas part of the operating system. The latter might happen in hardware at a providernetwork interface that is policing traffic entering the network. This technique wasproposed by Turner (1986) and is called the leaky bucket algorithm.

A different but equivalent formulation is to imagine the network interface as abucket that is being filled, as shown in Fig. 5-28(c). The tap is running at rate Rand the bucket has a capacity of B, as before. Now, to send a packet we must beable to take water, or tokens, as the contents are commonly called, out of thebucket (rather than putting water into the bucket). No more than a fixed numberof tokens, B, can accumulate in the bucket, and if the bucket is empty, we mustwait until more tokens arrive before we can send another packet. This algorithmis called the token bucket algorithm.

Leaky and token buckets limit the long-term rate of a flow but allow short-term bursts up to a maximum regulated length to pass through unaltered andwithout suffering any artificial delays. Large bursts will be smoothed by a leakybucket traffic shaper to reduce congestion in the network. As an example, imag-ine that a computer can produce data at up to 1000 Mbps (125 million bytes/sec)and that the first link of the network also runs at this speed. The pattern of trafficthe host generates is shown in Fig. 5-29(a). This pattern is bursty. The average

FIGURE: (a) Shaping packets (b) A leaky bucket (c) A tokenbucket.

Page 79: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

INTERNETWORKING I

I Interoperability of heterogenous networks.I How networks can be connected.I Tunneling.I Internetwork routing.I Packet fragmentation.

Page 80: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

THE NETWORK LAYER IN THE INTERNET I

A few design principles:1. Make sure it works.2. Keep it simple.3. Make clear choices.4. Exploit modularity.5. Expect heterogeneity.6. Avoid static options and parameters.7. Look for a good design; it need not be perfect.8. Be strict when sending and tolerant when receiving.9. Think about scalability.

10. Consider performance and cost.

I The IP Version 4 Protocol.

Page 81: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

THE NETWORK LAYER IN THE INTERNET II

SEC. 5.6 THE NETWORK LAYER IN THE INTERNET 439

not unusual in practice, and there are many longer paths. There is also muchredundant connectivity in the Internet, with backbones and ISPs connecting toeach other in multiple locations. This means that there are many possible pathsbetween two hosts. It is the job of the IP routing protocols to decide which pathsto use.

5.6.1 The IP Version 4 Protocol

An appropriate place to start our study of the network layer in the Internet iswith the format of the IP datagrams themselves. An IPv4 datagram consists of aheader part and a body or payload part. The header has a 20-byte fixed part and avariable-length optional part. The header format is shown in Fig. 5-46. The bitsare transmitted from left to right and top to bottom, with the high-order bit of theVersion field going first. (This is a ‘‘big-endian’’ network byte order. On little-endian machines, such as Intel x86 computers, a software conversion is requiredon both transmission and reception.) In retrospect, little endian would have beena better choice, but at the time IP was designed, no one knew it would come todominate computing.

Version IHL Total length

Time to live Protocol

Differentiated services

Identification

Header checksum

Fragment offset

Source address

Destination address

Options (0 or more words)

DF

MF

32 Bits

Figure 5-46. The IPv4 (Internet Protocol) header.

The Version field keeps track of which version of the protocol the datagrambelongs to. Version 4 dominates the Internet today, and that is where we havestarted our discussion. By including the version at the start of each datagram, itbecomes possible to have a transition between versions over a long period of time.In fact, IPv6, the next version of IP, was defined more than a decade ago, yet isonly just beginning to be deployed. We will describe it later in this section. Itsuse will eventually be forced when each of China’s almost 231 people has a desk-top PC, a laptop, and an IP phone. As an aside on numbering, IPv5 was an exper-imental real-time stream protocol that was never widely used.

FIGURE: The IPv4 (Internet Protocol) header.

I Internet Control Protocols.I ICMP – Internet COntrol Message Protocol.I ARP – The Address Resolution Protocol.

Page 82: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

THE NETWORK LAYER IN THE INTERNET III

I Label Switching and MPLS.I OSPF – An Interior gateway Routing Protocol.I BGP – The Exterior Gateway Routing Protocol.I Internet Multicasting.I Mobile IP.

Page 83: The Network Layer

The NetworkLayer

Muhammad AdilRaja

Introduction

Network LayerDesign Issues

RoutingAlgorithms

CongestionControlAlgorithms

References

REFERENCES

The inspiration and figures for these slides have beentaken from, Computer Networks, Andrew S. Tanenbaum,5th Edition.