computer networks - 中国传媒大学 计算机学院 课程/课件...

72
Computer Networks

Upload: duongdang

Post on 15-Apr-2018

227 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Computer Networks

Page 2: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Computer NetworksProf. Lin Weiguo

College of ComputingCopyleft © [email protected]

http://icourse.cuc.edu.cn/computernetworks/http://tlc.cuc.edu.cn

Page 3: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 3

Attentionl The materials below are available for use by others.

Instructors are welcome to use them in their own courses, download them to their own class' web site, or modify them to suit. However, you must acknowledge the source of the original and not attempt to place your own copyright on this material.

l Thanks to�

http://authors.phptr.com/tanenbaumcn4/

2018/4/17

Page 4: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 4

RoadmapIntroduction

Physical Layer

Data Link Layer

Transport Layer

Network Layer

Medium Access Sublayer

Application Layer

2018/4/17

Page 5: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

The Network Layer

Chapter 5

Page 6: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Now I have come to the crossroads in my days, and I have always known the right path, always, without exception, I knew. But I never took it, you know why? Because it's too damn hard.

---Al Pacino, scent of a woman

2018/4/17 [email protected] 6

Page 7: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Do you Taobao? l logistics

2018/4/17 [email protected] 7

2013-03-18 17:42:43����B2013-03-21 21:59:06.�"�B $��.�"�B@C,-�!.��&�#2013-03-22 00:03:30.��&�#$��.��&�#@C,-�!=��&�#2013-03-22 00:04:13.��&�#$��E.��&�#,��7*.�"�B2013-03-22 22:18:13=��&�#$��E=��&�#,��7*5��&�#2013-03-22 22:32:08=��&�#$��=��&�#@C,-�!)H�&�#2013-03-23 02:29:42)H�&�#$��E)H�&�#,��7*=��&�#2013-03-23 02:35:38)H�&�#$��)H�&�#@C,-�!��&�#2013-03-23 23:36:32��&�#$��E��&�#,��7*)H�&�#2013-03-24 07:57:42��&�#$����&�#@C,-�!+J��G2013-03-24 13:24:54+J��G$��E+J��G,��7*��&�#2013-03-24 20:01:11+J��G�8(�8(* ��8(:0*+J��G

2013-04-07 12:03:58����B2013-04-07 20:36:24�5�"����-�F>�@?�%'2013-04-07 23:02:383�5�.�;6G��!���DG�2013-04-09 01:05:433���DG��!��9����2013-04-09 06:53:13$���E��9����%'�*�1< ���7*��2013-04-09 07:50:52��9����4/����K,�-�/�2013-04-09 10:51:02�8(,8(*AI�20

Page 8: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 8

What you will learn:

l 5.1 Network layer design issues

l 5.2 Routing algorithms

l 5.3 Congestion control algorithms

l 5.4 Quality of service

l 5.5 Internetworking

l 5.6 The Networking layer in the internet

The Network Layer is concerned about getting packets from

source to destination, no matter how many hops it may take.

It’s all about routing .

2018/4/17

Page 9: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 9

5.1 Network Layer Design Issues

• Store-and-Forward Packet Switching• Services Provided to the Transport Layer• Implementation of Connectionless Service• Implementation of Connection-Oriented Service• Comparison of Virtual-Circuit and Datagram

Networks

2018/4/17

Page 10: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

OSI Reference Model

2018/4/17 [email protected] 10

Page 11: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Communication subnet

2018/4/17 [email protected] 11

Page 12: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 12

Store-and-Forward Packet Switching

The environment of the network layer protocols.

2018/4/17

ISP�s equipment

xDSL

Page 13: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Store-and-Forward Packet Switching Mechanisml A host with a packet to send transmits it to

the nearest router, either on its own LAN or over a point-to-point link to the carrier.

l The packet is stored there until it has fully arrived so the checksum can be verified.

l Then it is forwarded to the next router along the path until it reaches the destination host, where it is delivered

[email protected] 132018/4/17

Page 14: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 14

Who-Does-Whatl The network layer is responsible for routing packetsfrom the source to destination.

l The routing algorithm is the piece of software thatdecides where a packet goes next (e.g., whichoutput line, or which node on a broadcast channel).

l For connectionless networks, the routing decision ismade for each datagram. For connection-orientednetworks, the decision is made once, at circuit setuptime.

2018/4/17

Page 15: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 15

Design Goal of the Network Layer

1. Services independent of router technology.

2. Transport layer shielded from number, type, topology of routers.

3. Network addresses available to transport layer use uniform numbering plan- even across LANs and WANs

2018/4/17

Page 16: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

The Discussion

“Does error/flow control belong in network or transport layer?”

(Whether the network layer should provide connection-oriented service or connectionless service)

2018/4/17 [email protected] 16

Page 17: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Internet community viewpointl The subnet is inherently unreliable no matter

how it is designed. l Thus, hosts are forced to do error/flow control

anyway. l Given that they perform error/flow control, why

have the network layer duplicate the same function?

l The TCP/IP Internet is connectionless in its implementation but provides connections to its users.

2018/4/17 [email protected] 17

Page 18: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Telephone Companies Viewpoint

l The connection oriented approach is the right way.

l Users don't want complex error/flow control protocols in host machines.

l User's want reliable, trouble-free service. Quality of Service is the dominant factor.

2018/4/17 [email protected] 18

Page 19: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Datagram vs. Virtual Circuitl Datagram for connectionless service:

l Each packet sent is routed independently of its predecessors. Decisions are made "on the fly", so more computing required, however this method is more robust.

l Virtual Circuit for connection-oriented service:l A path from the source router to the destination router must be

established before any data packets can be sent.l Avoids choosing a new route for each packet. A virtual circuit is

a state -- it remembers how to send a packet from source to destination. This state is held in the subnet, in the source DLL or in each of the DLL layers along the route.

2018/4/17 [email protected] 19

Page 20: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 20

Implementation of Connectionless Service

Routing within a datagram network.

Every router has an internal table telling it where to send packets for each possible dest. Each table entry is a pair consisting of a destand the outgoing line to use for that dest.

2018/4/17

A�s table (initially) A�s table (later) C�s Table E�s Table

ISP’s equipment

Page 21: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 21

Implementation of Connection-Oriented Service

Routing within a virtual-circuit network.Incoming packets with connection id 1 is to be sent to router C and given id 1

2018/4/17

A�s table C�s Table E�s Table

ISP’s equipment

Page 22: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 22

Label Switchingl Virtual Circuit

l Call setup, teardown for each call before data can flowl Each packet carries VC identifier (not destination host ID)l Every router on source-destination path maintains “state”

for each passing connectionl Transport-layer connection only involved two end systemsl Link, router resources (bandwidth, buffers) may be

allocated to VCl MPLS(MultiProtocol Label Switching)

l Used within ISP networks in the Internet, with IP packets wrapped in an MPLS header having a 20-bit connection ID.

2018/4/17

Page 23: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 23

Comparison of VC and Datagram Networks

2018/4/17

Page 24: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 24

Trade-offs between VC and datagraml Setup time versus address parsing time

l Using VC requires a setup phase, which takes time. In a datagram subnet, a more complicated lookup procedure is required to locate the entry for the destination.

l Overhead and bandwidthl If the packets tend to be fairly short, a full dest. address in

every packet may represent a significant amount of overhead and wasted bandwidth.

l Amount of table space in router memoryl Datagram network needs entry for each possible destination l Whereas a VC network just needs an entry for each VC

2018/4/17

Page 25: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 25

5.2 Routing Algorithms• The Optimality Principle• Shortest Path Routing• Flooding• Distance Vector Routing• Link State Routing• Hierarchical Routing• Broadcast Routing• Multicast Routing• Anycast Routing• Routing for Mobile Hosts• Routing in Ad Hoc Networks

2018/4/17

Page 26: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Routing and Forwardingl One can think of a router as having two

processes inside it.l Forwarding process: handles each packet as it

arrives, looking up the outgoing line to use for it in the routing tables.

l Routing process: responsible for filling in and updating the routing tables.--that is where the routing algorithm comes into play.

2018/4/17 [email protected] 26

Page 27: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 27

Routing Algorithmsl Routing is concerned with the question:

l Which line should router J use when forwarding a packet to router K ?

l Goal: determine “good” path (sequence of routers) through network from source to destination

l The routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on.

2018/4/17

Page 28: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 28

Goals for Routing Algorithmsl Correctness and Simplicityl Robustness

• networks are never taken down; individual parts (e.g., links,routers) may fail, but the whole network should not.

• During years of continuous operation, being able to handleall kinds of hardware and software failures. Being able tohandle changes in topology and traffic patterns.

l Stabilityl A stable algorithm reaches equilibrium and stays there. It

should converge quickly too.

l Fairness and efficiencyl Often contradictory

2018/4/17

Page 29: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 29

Fairness vs. Efficiency

Network with a conflict between fairness and efficiency.

2018/4/17

Page 30: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 30

Types of Algorithmsl Non-adaptive algorithms

l Routes never change once initial routes have been selected.Also called static routing.

l Because it does not respond to failures, static routing is mostlyuseful for situations in which the routing choice is clear.

l Adaptive algorithmsl Use such dynamic information as current traffic, topology, delay,etc. to select routes.

l Differ in where they get information(locally, adjacent routers, orall routers), when they change the routes(when changes happen,every Δt), and what metric is used for optimization(distance,number of hops, estimated transit time).

2018/4/17

Page 31: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 31

The Optimality Principlel This simply states that if router J is on theoptimal path from router I to router K, thenthe optimal path from J to K also falls alongthis same path.

l This means we can form a sink tree (optimalpaths to B) as in the next Figure.

2018/4/17

I KJ

Page 32: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 32

Sink tree

(a) A network. (b) A sink tree for router B.2018/4/17

Sink tree: the set of optimal routes from all sources toa given destination form a tree rooted at thedestination. The goal of all routing algorithms is todiscover and use the sink trees for all routers.

Page 33: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 33

Graph abstractionl Graph abstraction for routing algorithms:

l 1.graph nodes are routersl 2.graph edges are physical links

l link cost: delay, $ cost, or congestion levell To choose a route between a given pair of

routers: find �Good” pathl typically means minimum cost pathl other definitions possible

2018/4/17

Page 34: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 34

Shortest Path Routingl Often used because simple and easy to

understandl Shortest Path Metrics (Path Length)

l Number of Hopsl Physical Distancel Mean Queuing and Transmission Delayl Bandwidthl Average Trafficl Communication Cost

2018/4/17

Page 35: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 35

Dijkstra's algorithml Use Dijkstra's algorithm (or variation)

(SPF, Shortest Path First algorithm)Basic idea is:

l Choose the source, and put nodes connected tosource in list to consider.

l From the list to consider choose the nearestnode.

2018/4/17

Note: Edsger Wybe Dijkstra (1930 –2002; [ˈɛtsxər ˈwibə ˈdɛɪkstra])

Page 36: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 36

The Algorithm on a Weighted, Undirected Graph

The first 6 steps used in computing the shortest path from A to D. The arrows indicate the working node.

2018/4/17

Page 37: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 37

Dijkstra’s Algorithm1 Initialization:2 N = {A} 3 for all nodes v 4 if v one-step reachable from A 5 then D(v) = c(A,v) 6 else D(v) = infinity 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v one-step reachable from w

and not in N: 12 D(v) = min( D(v), D(w) + c(w,v) )13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */15 until all nodes in N2018/4/17

Page 38: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 38

Dijsktra’s Algorithm

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

5-8 top

2018/4/17

Page 39: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 39

Dijsktra’s Algorithm

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

5-8 bottom

2018/4/17

Page 40: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 40

Floodingl Flooding is a form of isolated routing. Does notselect a specific route. When a router receives apacket, it sends a copy of the packet out on eachline (except the one on which it arrived).

l To prevent packets from looping forever, each routerdecrements a hop count contained in the packetheader. Whenever the hop count decrements tozero, the router discards the packet.

2018/4/17

Page 41: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 41

Flooding – Reduce Looping• Add a sequence number to each packet.• Each router maintains a private sequencenumber. When it sends a new packet, it copiesthe sequence number into the packet, andincrements its private sequence number.

• For each source router S, a router:a) Keeps track of the highest sequence number seen from S.b) Whenever it receives a packet from S containing a sequence

number lower than the one stored in its table, it discards thepacket.

c) Otherwise, it updates the entry for S and forwards thepacket on

2018/4/17

Page 42: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 42

Flooding uses

l Flooding has several important uses:• In military applications, the network mustremain robust in the face of (extreme)hostility

• Sending routing updates, because updatescan't rely on the correctness of a router'srouting table.

• Theoretical-chooses all possible paths, soit chooses the shortest one.

2018/4/17

Page 43: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Distance Vector Routingl Also known as Bellman-Ford, used in the Internet under

name RIPl Each router maintains a table (vector) giving the best known distance to

a destination and the line to use for sending there. Tables are updated by exchanging information with neighbors.

l Each router knows the distance (cost) of reaching its neighbors (e.g. send echo requests).

l Routers periodically exchange routing tables with each of their neighbors.

l Upon receipt of an update, for each destination in its table, a router:l Compares the metric in its local table with the metric in the neighbor's table

plus the cost of reaching that neighbor.l if the path via the neighbor has a lower cost, the router updates its local table

to forward packets to the neighbor

2018/4/17 [email protected] 43

Page 44: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 44

D-V Routing Example

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

Metric is delay• JàA: 8 ms• JàI: 10ms• JàH: 12ms• JàK: 6ms Outgoing link

to usecost

dest

inat

ion

2018/4/17

Page 45: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 45

The Count-to-Infinity Probleml This algorithm was used in the originalARPANET. Unfortunately, it suffers from theproblem: convergence takes time, good newstravels quickly, bad news travels slowly(count-to-infinity problem).l Convergence: the settling of routes to best pathsacross the network is called convergence.

2018/4/17

Page 46: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 46

The Count-to-Infinity Problem

The count-to-infinity problem.

Suppose A is down initially and all the Others know this.When A comes up, the other routers Learn about it via the vector exchanges.

All routers are initially up, and Suddenly A goes down

2018/4/17

Page 47: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 47

The Count-to-Infinity Probleml The core of the problem is:

l When X tells Y that it has a path somewhere, Y has no way of knowing whether it itself is on the path.

l Attempts to solve:l Split horizon with poisoned reverse in RFC 1058

2018/4/17

Page 48: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Problems with D-Vl The `old' Arpanet routing algorithm was replaced

in 1979. Problems with old algorithm included:l High-priority routing update packets were large,

adversely affecting traffic.

l Network was too slow in adapting to congestion, too fast to react to minor changes.

l Average queue length was used to estimate delay. l This works only if all lines have the same capacity and

propagation delay.

l Doesn't take into account that packets have varying sizes.

2018/4/17 [email protected] 48

Page 49: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Link State Routing l Each router maintains a database describing the

topology and link delays between each router. That is, each router keeps track of the full graph of links and nodes. l Avoids the count to infinity problem since all routers get each

other router’s information.

l Each router uses an SPF algorithm to calculate shortest paths based on the current values in its database. l Because each router makes its calculation using the same

information, better routing decisions are made.2018/4/17 [email protected] 49

Page 50: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 50

Five StepsEach router must do the following:1. Discover its neighbors, learn who its neighbors are.2. Set distance/cost metric to each of its neighbors.3. Construct a packet telling all it has just learned.4. Send this packet to, receive packets from all other

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

2018/4/17

Page 51: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

l When a router is booted, its first task is to learn who its neighbors are. It accomplishes this goal by sending a special HELLO packet on each point-to-point line.

l The router on the other end is expected to send back a reply giving its name. These names must be globally unique.

[email protected] 51

Learning about the Neighbors

2018/4/17

Page 52: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

A graph model of a networkl Modeling the LAN:

l introduced a new, artificial node, N, to which A,C, and F are connected. One designated router on the LAN is selected to play the role of N in the routing protocol.

2018/4/17 [email protected] 52

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

Page 53: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 53

Setting Link Costl The cost to reach neighbors can be set automatically, or

configured by the network operator. l A common choice is to make the cost inversely proportional to the

bandwidth of the link.l If the network is geographically spread out, the delay of

the links may be factored into the cost so that paths over shorter links are better choices.l The most direct way to determine this delay is to send over the

line a special ECHO packet that other side is required to send back immediately.

l By measuring the round-trip time and dividing it by two, the sending router can get a reasonable estimate of the delay.

2018/4/17

Page 54: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 54

Building Link State Packets

(a) A network. (b) The link state packets for this subnet.

•ID of the sender•Sequence number (32-bits, one per second, wrap around after 137 years)•Age for the packet (decrement once per second)•A list of neighbors and delay for it

2018/4/17

Page 55: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 55

Distributing the Link State Packets l Basic distribution algorithm: Flooding

l To keep the flood in check, each packet contains a sequence number that is incremented for each new packet sent.

l Routers keep track of all the (source router, sequence) pairs they see (in a link state database). When a new link state packet comes in, it is checked against the list of packets already seen. l If it is new, it is forwarded on all lines except the one it

arrived on. l If it is a duplicate, it is discarded.l If a packet with a sequence number lower than the highest

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

2018/4/17

Page 56: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 56

The Age fieldl Problems:

l Sequence number confusionl Router crashes and lose track of its sequence num.l A sequence number is corrupted.

l Solution: The Age field l Include the age of each packet after the Seq. and decrement it once

per second. When the age (in the router’s link state database) hits zero, the information from that router is discarded.

l The age field is also decremented by each router during the initial flooding process, to make sure no packet can get lost and live for an indefinite period of time (a packet whose age is zero is discarded).

2018/4/17

Page 57: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 57

Algorithm Refinementsl When a link state packet comes in to a router for

flooding, it is not queued for transmission immediately. Instead it is first put in a holding area to wait a short while. If another link state packet from the same source comes in before the first packet is transmitted, their sequence numbers are compared. l If they are equal, the duplicate is discarded.l If they are different, the older one is thrown out.

l To guard against errors on the router-router lines, all link state packets are acknowledged.

2018/4/17

Page 58: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 58

Example LSP buffer for router B

The packet buffer for router B in the previous slide (Fig. 5-12a).

The send flags mean that the packet must be sent on the indicated link.The ack flags mean that it must be acknowledged there.

l To reduce the numbers of link state packets, wait for a short time and set 2 flags before forward the received link state packets :

2018/4/17

the third packet, from E, is different. It arrived twice, once via EAB and once via EFB

it has to be sent only to C but acknowledged to both A and F

1 1 1

Page 59: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 59

Computing the New Routesl Once a router has accumulated a full set of link

state packets, it can construct the entire network graph because every link is represented. Every link is, in fact, represented twice, once for each direction. The different directions may even have different costs.

l Now Dijkstra's algorithm can be run locally to construct the shortest path to all possible destinations. The results of this algorithm can be installed in the routing tables, and normal operation resumed.

2018/4/17

Page 60: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 60

Limitations of Link State Routing

l For large networks, the memory required to store the input data and the computation time can be an issue.

l Nevertheless, in many practical situations, link state routing works well because it does not suffer from slow convergence problems.

2018/4/17

Page 61: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 61

Example Protocols using Link State Routing Algorithml IS-IS (Intermediate System-Intermediate

System) in some Internet backbones.l OSPF (Open Shortest Path First) in Internet

(5.6.6)

2018/4/17

Page 62: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 62

Hierarchical Routing

Hierarchical routing.2018/4/17

Page 63: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 63

Broadcast Routingl Sending a packet to all destinationssimultaneously is known as broadcasting.

l There are several ways to implementbroadcasting:l For Broadcast Networks:The implementation is trivial: designate a specialaddress as the `all hosts address'.

2018/4/17

Page 64: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 64

Broadcast Routingl For Non-Broadcast Networks:

1. Send a unicast packet to each destination. However, thisapproach makes poor use of resources.

2. Flood packets to all nodes. Flooding generates manypackets and consumes too much bandwidth.

3. Use multi-destination routing:a) Each packet contains a list (or bitmap) of all destinations, and

when a router forwards a packet across two or more lines, itsplits the packet and divides the destination addressesaccordingly.

b) This approach is similar to sending uni-cast packets, exceptthat we don't send individual copies of each messages.

c) However, the copy operations slow down the ability of arouter to process many packets.

2018/4/17

Page 65: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 65

Broadcast Routing• For Non-Broadcast Networks:

4. Use a spanning tree. If the network can be reduced to a treea) (There’s only one path between any two pairs of routers), copy a

packet to each line of spanning tree except the one on which itarrived.

b) Works only if each router understands the same spanning tree.

5. Reverse Path Forwarding (RPF):a) Use a sink tree (assume sink/source trees are the same).b) If a packet, originating from X, arrives on a line of the sink tree

leading to X, the packet is traveling along the shortest path, soit “must” be the first copy we've seen.

c) Copy the packet to all outgoing lines of the sink tree.

If the packet arrives on another line, assume that the packet is acopy - it didn't arrive on the shortest path - and discard it. RPFis easy to implement and makes efficient use of bandwidth.

2018/4/17

Page 66: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 66

Reverse path forwarding

Reverse path forwarding. (a) A network. (b) a Sink tree for router I. (c) The tree built by reverse path forwarding.2018/4/17

Page 67: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 67

Multicast Routing

(a) A network. (b) A spanning tree for the leftmost router. (c) A multicast tree for group 1. (d) A multicast tree for group 2.

2018/4/17

Page 68: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Multicast Routing

2018/4/17 [email protected] 68

(a) Core-based tree for group 1.(b) Sending to group 1.

Page 69: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Anycast Routing

2018/4/17 [email protected] 69

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

Page 70: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Routing for Mobile Hostsl Mobile Hosts - machines that are not

currently connected to their home location. Must get traffic to base host. Need intermediary agents. Look at Figures 5.19. Base host uses encapsulation (tunneling) to send packet to mobile host.

2018/4/17 [email protected] 70

Page 71: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

[email protected] 71

Routing for Mobile Hosts

2018/4/17

Packet routing for mobile hosts

Page 72: Computer Networks - 中国传媒大学 计算机学院 课程/课件 …icourse.cuc.edu.cn/computernetworks/Slides/chapter5... ·  · 2016-05-08l 5.1 Network layer design issues

Routing in Ad Hoc Networks

2018/4/17 [email protected] 72

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

The shaded nodes are new recipients. The dashed lines show possible reverse routes. The solid lines show the discovered route.