cn lecture 7

55
Packet Switching

Upload: ahmed-algadri

Post on 21-Jul-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cn Lecture 7

Packet Switching

Page 2: Cn Lecture 7

Packet-Switching PrinciplesStore & forward scheme

Message is split into size-limited packets for transmission

Pipelining of packet transmissionAdvantages over circuit-switching

Greater line efficiency due to sharing of line capacity Sender and receiver do not need to be

simultaneously ready Easy message prioritization Easy data-rate conversion

Page 3: Cn Lecture 7

Two schemes for packet switchingDatagrams: each packet is individually routed

through networkVirtual circuits: a virtual circuit is first established;

all packets then follow this path, one following the otherDatagram

Better flow balancing No call-setup phase More flexible More reliable

Virtual circuit Easier error & flow control Small packet headers more efficient use of bandwidth for

interactive, small packet traffic

Page 4: Cn Lecture 7

Packet Size •Design Issue

–Packet size vs. Overhead –Packet size vs. Number

of packets sent for a given message size.

•Effect of packet size on transmission time

•Effect of packet size on processing and queuing delay - these effects are more pronounced for smaller packet size – smaller packet will require high overhead but lower queuing delay

Page 5: Cn Lecture 7

Comparison of Communication

Switching Techniques

Page 6: Cn Lecture 7

Comparison of Switching Techniques

Page 7: Cn Lecture 7

External and Internal Operation of Packet Switching

Externally, to the user a Packet Switching Network (PSN) may appear as a datagram (connectionless) or VC (connection-oriented) service; its internal structure can be different from the external structure.

External view: interface between host and PSN

Internal view: operations inside PSN

Page 8: Cn Lecture 7

External Operation of Packet SwitchingVirtual circuit service (external view)

Packets are delivered error-free and in sequence Provide flow and error control (Most network applications demand sequential, error-free,

flow controlled service)Datagram service (external view)

Packets may arrive out of sequence, be damaged, be duplicated, or be lost.

No flow and error control Higher throughput (For some applications, efficiency is more important than an

occasional erroneous or omitted packet. For some applications (e.g., credit checking, banking) higher level protocol will implement flow and error control anyway. Virtual circuit just introduces unnecessary redundancy.)

Page 9: Cn Lecture 7

External Virtual Circuit

Page 10: Cn Lecture 7

External Datagram

Page 11: Cn Lecture 7

Internal Operation of Packet SwitchingVirtual circuit operation (internal view)

Connection establishment (make routing decision only once) Minimize per-packet overhead (only need virtual circuit

number in every packet) The failure of a node or link could destroy some virtual circuits

Datagram operation (internal view) No connection establishment (each packet is delivered

independently) High bandwidth overhead (full destination address in every

packet) More flexible: react more quickly to traffic condition by making

routing decisions on a per-packet basis More robust: if nodes or links are failed, packets can be

routed around the affected area

Page 12: Cn Lecture 7

Internal Virtual Circuit

Page 13: Cn Lecture 7

Internal Datagram

Page 14: Cn Lecture 7

RoutingIn a packet switched network, need to determine a path

from a sender to a destination; usually multiple paths exist, so need to choose one.

Responsibility of the network layerDone on a session basis in virtual circuits and on a packet

basis in datagramsDesirable characteristics:

Correctness Simplicity Robustness Stability Fairness Optimality Efficiency

Page 15: Cn Lecture 7

Routing Issues• scalability: must be able to support large numbers of

hosts, routers, networks• adapt to changes in topology or significant changes in

traffic, quickly and efficiently• self-healing: little or not human intervention• route selection may depend on different criteria• performance: “choose route with smallest delay”• policy: “choose a route that doesn’t cross a

government network” (equivalently: “let no non-government traffic cross this network”)

Page 16: Cn Lecture 7

Routing Table Issues• key question: how are routing tables

determined/updated?– who determines table entries?– what info used in determining table entries?– when do routing table entries change?– where is routing info stored?– how to control table size?– why are routing tables determined a particular

way. – What is the theoretical basis?

Page 17: Cn Lecture 7

Classification of Routing Algorithms• centralized versus decentralized

– centralized: central site computes and distributed routes (equivalently: information for computing routes known globally, each router makes same computation)

– decentralized: each router sees only local information (itself and physically-connected neighbors) and computes routes on this basis

• Static versus adaptive– static: routing tables change very slowly, often in response to human

intervention– dynamic: routing tables change as network traffic or topology change

• Two basic approaches adopted in practice:– link-state routing: centralized, dynamic (periodically run)– distance vector: distributed, dynamic (in direct response to changes)

Page 18: Cn Lecture 7

Link State Routing• each node knows network topology and cost of each link

– quasi-centralized: each router periodically broadcasts costs of attached links

• cost may reflect– queueing delay on link– link bandwidth– all links with equal cost: shortest path routes

• used in Internet OSPF, ISO IS-IS, DECnet, “new” (1980) ARPAnet routing algorithm

• goal: find least cost path from one node (source) to all other nodes: – ex: Dijkstra’s shortestpath algorithm

Bellmon Ford Algorithm

Page 19: Cn Lecture 7

Least-Cost Algorithms (Determining least-cost paths)

Dijkstra’s algorithmN = set of nodes in the networks = source nodeM = set of nodes so far incorporated by the algorithmdij = link cost from node i to j; dii = 0, and dij = if nodes are not directly connectedDn = cost of the least-cost path from node s to node n that is currently known to the

algorithmAlgorithm

1. Initialize: M = {s}, Dn = dsn for n s2. Find the neighboring node not in M that has the least-cost path from node s

and incorporate that node into MFind w M s.t Dw = min(j M) Dj

Add w to M3. Update least-cost paths:

Dn = min[Dn , Dw + dwn] for all n MRepeat steps 2 & 3 until M = N

Page 20: Cn Lecture 7

Example Network

Page 21: Cn Lecture 7
Page 22: Cn Lecture 7
Page 23: Cn Lecture 7

Bellman-Ford algorithms = source nodedij = link cost from node i to j; dii = 0, and dij = if nodes

are not directly connectedh = maximum number of links in a path at the current

stage of the algorithm Dn

(h) = cost of the least-cost path from node s to node n under the constraint of no more than h links

Algorithm1. Initialize:

Dn(0) = for all n s

Ds(h) = 0 for all h

2. For each successive h 0Dn

(h+1) = min(j) [Dj(h) + djn]

Page 24: Cn Lecture 7
Page 25: Cn Lecture 7
Page 26: Cn Lecture 7

Distance vector routing• asynchronous, iterative, distributed computation:• at each step:

– receive info from neighbor or notice change in local link cost– compute– possibly send new info to adjacent neighbors

• computation/communication between network layer entitites!

• Distance table:• per-node table recording cost to all other nodes via each of its neighbors• DE(A,B) gives minimum cost from E to A given that first node on path is B

• DE(A,B) = c(E,B) + min DB(A,*)• minDE(A,*) gives E’s minimum cost to A• routing table derived from distance table

• example: DE(A,B) = 14 (note: not 15!)• example: DE(C,D) = 4, DE(C,A) = 6

Page 27: Cn Lecture 7

Distance vector algorithm

1. based on Bellman-Ford algorithm2. used in many routing protocols: Internet BGP, ISO IDRP,

Novell IPX, original ARPAnetAlgorithm (at node X):

Initialization: for all adjacent nodes v:DX(*,v) = infinityDX(v,v) = c(X,v)send shortest path cost to each destination to neighbors

loopexecute distributed topology update algorithm

Forever

Page 28: Cn Lecture 7

Topology Update AlgorithmsAt node X:1. wait (until I see a link cost change to neighbor Y

or until I receive update from neighbor W)2. if (c(X,Y) changes by delta) {

/* change my cost to my neighbor Y */change all column-Y entries in distance table by deltaif this changes my least cost path to Zsend update wrt Z, DX(Z,*) , to all neighbors}

3. if (update received from W wrt Z) {/* shortest path from W to some Z has changed */DX(Z,W) = c(X,W) + DW(Z,*)if this changes my least cost path to Zsend update wrt Z, DX(Z,*) , to all neighbors

Page 29: Cn Lecture 7

Distance vector routing: example:

DX(Z,Y)=c(X,Y) +minDY(Z,*) = 2 + 1 = 3 DX(Y,Z)=c(X,Z) +minDZ(Y,*) = 7 + 1 = 8

Page 30: Cn Lecture 7

Distance vector routing: recovery from link failure

• if link XY fails, set c(X,Y) to infinity and run topology update algorithm

• example (next page)• good news travels fast, bad news travels slow• looping:

– inconsistent routing tables: to get to A, D routes through E, but E routes through D

– loops eventually disappear (after enough iterations)– loops result in performance degradation, out-of-order

delivery

Page 31: Cn Lecture 7

How many steps are required for the network to recover after link A-E is restored?

Link A-E is broken

Page 32: Cn Lecture 7
Page 33: Cn Lecture 7

Routing StrategiesFixed Routing

Routes fixed for a given topology Central routing directory created using

some optimality criterion Each node only needs to store the first-

hop destination for each of the paths Simple but does not react to network

congestion or failure

Page 34: Cn Lecture 7

Routing Strategies – Fixed Routing

Page 35: Cn Lecture 7

Routing Strategies - FloodingFlooding

Source sends packet to all nodes connected to it When a node receives packet, it forwards it to all

nodes except the one that gave the packet Most robust, but tremendous waste of network

capacity Guarantees minimum-hop delivery Used usually for broadcast; need mechanism to

control indefinite retransmissions: use packet id or hop counter decremented every hop (initialized to network diameter)

Also used when ultra-reliable delivery is required. e.g. military applications

Also recently used for wireless ad hoc networks

Page 36: Cn Lecture 7

Routing Strategies – Flooding (2)

Page 37: Cn Lecture 7

Reverse path forwarding

• goal: avoid flooding duplicates• assumptions:

– A wants to broadcast– all nodes know predecessor node on

shortest path back to A• reverse path forwarding: if node receives

a broadcast packet– if packet arrived on predecessor on

shortest path to A, then flood to all neighbors

– otherwise ignore broadcast packet - either already arrives, or will arrive from predecessor

Page 38: Cn Lecture 7

Multipath Routing• At router, given packet with particular final

destination, several choices for next router are enumerated – each choice is assigned routing probability– for given packet, actual routing choice is made by

sampling corresponding probability function (pmf)• Applicable to VC networks as well as datagram

networks– in VC network, path of setup packet is determined

stochastically

Page 39: Cn Lecture 7
Page 40: Cn Lecture 7

Multipath routing• Multipath routing can yield more stable traffic patterns than shortest path routing

– e.g., shortest path routing with link utilization as cost can result in traffic oscillations• Availability of multiple paths between source and destination pair can be used to

decrease vulnerability to faults• Alternative routes can be determined by other means

– e.g., assign traffic to routes based on priorities– Example: an interactive connection between terminal and remote computer could be routed over fiber

to minimize delay, while file transfer between same host and destination could be routed via satellite• Advantages

> Increases reliability over single path approaches> Improves performance

• reduces congestion• provides the ability to provide class of service distinction

• Disadvantages> More complex > More memory space

Page 41: Cn Lecture 7

Routing Strategies – Random RoutingRandom routing

When a node receives packet, it selects only one outgoing

Can be improved by making probabilistic decision based on link data rates:

Like flooding, require no network information Simple but not in common use

i i

ii R

RP

Prob. of picking link i

Data rate on link i

Data rate on all links

Page 42: Cn Lecture 7

Routing Strategies – Adaptive RoutingAdaptive routing

Routing strategy that continuously changes to adapt to changing environment

Can improve performance, but algorithms become much more complex; increases processing burden and traffic burden; may react too quickly, causing congestion-producing oscillation

Three types of adaptive strategies• Isolated adaptive: local info., distributed control• Distributed adaptive: info. from neighbors, distributed

control• Centralized adaptive: info. from all nodes, centralized

control

Page 43: Cn Lecture 7

Example of a simple isolated adaptive routing

Page 44: Cn Lecture 7

Distributed Routing–Methodology

>Routing decisions are made at the node based on traffic conditions at neighboring nodes – using distance vector routing

>Each node exchanges routing information with each of its neighbors» Directly»“Backward Learning”

-Each incoming packet contains information on the incoming port number, source location and distance to source>Information is used to build/update RT to distant nodes.

–Example (for figure in the next slide)>Construct a new route from J to G

via node A = 18 + 8 = 26via node I = 31 + 10 = 41via node H = 6 + 12 = 18via node K = 31 + 6 =37

Page 45: Cn Lecture 7

Distributed routing

Page 46: Cn Lecture 7

Centralized Routing–Methodology

>Routing decisions are made at a central location based on global traffic conditions.>Routing Control Center (RCC) receives information from all network nodes and

computes routes>Routing tables are then downloaded to each node

–Advantages>Near perfect routing decisions >Relieves switches of computational burden

–Disadvantages>Overhead of update traffic detracts from network Utilization>Single point of failure>Complexity>Routing inconsistencies

Page 47: Cn Lecture 7

Multicast Routing• GOAL: deliver packet from one sender to many (but not all) other hosts

– deliver to M hosts in N-host network (M<N)– option 1: sender establishes M point-to-point connections– option 2: sender sends one packet, which is duplicated and forwarded, as needed by

routers:• router A duplicates packet• router B selectively forwards

• multicast abstraction:– multicast address associated

with multicast group– hosts join/leave multicast group– sender sends packet to multicast

address (destination)– routers delivers to hosts that

joined group address

Page 48: Cn Lecture 7

Multicast Routing: Link State• GOAL: route packets to all hosts that joined

multicast address• Each router uses link state flooding to distribute:

– cost to neighbors– multicast addresses it wants to receive (has attached

host joined to that group)• Each router computes:

– regular unicast routing (e.g., Dijkstra’s algorithm)– spanning tree for M nodes joined to each active

multicast address• spanning tree: set of links connecting M nodes together in a

tree

Page 49: Cn Lecture 7

Multicast Routing: Link State (cont)• one possible spanning tree algorithm:

– find node with “smallest” host address among M– use Dijkstra’s algorithm to build tree, rooted at that

host that reaches all M– note: tree below is not “minimum cost”!

Page 50: Cn Lecture 7

Multicast Routing: Distance Vector

• packet arrives with multicast address m– look at sender address– use reverse path forwarding to flood to downstream

routers that want mcast packet with that address• Pruning: how to know if “downstream” router

want mcast packet?– host informs nearest router of addresses it wants– router Y tells router X:

• if X wants mcast address and Y on X’s shortest path to source, then Y wants that address so that Y can forward the mcast packet to X after receiving it from source

Page 51: Cn Lecture 7

Multicast Routing: Distance Vector - cont

• E will forward A’s mcast pkts to D• E will not forward A’s mcast pkts to D• A will not forward E’s mcast pkts to B• B will not forward any mcast pkts to C• Question: E, B, A forwarding of D’s mcast pkts?

BA

Page 52: Cn Lecture 7

Hierarchical Routing

• For large networks, not practical to store routing table in each router that contains an entry for every other router in network

• organize routers in a hierarchy – routing table has entry for its parents, siblings,

and children • not necessarily a tree

– generally results in suboptimal routes

Page 53: Cn Lecture 7

Example of hierarchical routing

Page 54: Cn Lecture 7

Hierarchical Routing• Problem

> Large networks - Large Routing Tables> Increased requirements for memory and processor power> Increased network management traffic

– Methodology> Divide the network up into regions> Each node has a table that specifies a path to

» each node in the same region» the nearest node in each neighboring region

> Similar to telephone network area codes> The larger the network, the larger the number of regions

(hierarchical levels)– Example: Fig 5-20 below

> 17 node network with 17 entry RT vs. 5 region network with 6-9 entries per table

– What is an optimal number of levels?> For N nodes ---- ln N levels, e ln N entries per node> For N = 17, ln(17) = 3 levels, e ln(17) = 7 entries per node

Page 55: Cn Lecture 7