35
Routing Routing is done by the network layer protocol to guide packets through the communication subnet to their destinations The time when routing decisions are made depends on whether we are using virtual circuits or datagrams connections In a datagram network two successive packets between the same pair of source and destination nodes may travel along different routes and routing decisions is made for each individual packet In virtual circuit network, a routing decision is made when each virtual circuit connection is set up Information Networks – p.1/35

Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Routing

Routing is done by the network layer protocol to guidepackets through the communication subnet to theirdestinations

The time when routing decisions are made depends onwhether we are using virtual circuits or datagramsconnections

In a datagram network two successive packets betweenthe same pair of source and destination nodes maytravel along different routes and routing decisions ismade for each individual packet

In virtual circuit network, a routing decision is madewhen each virtual circuit connection is set up

Information Networks – p.1/35

Page 2: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Routing

Routing requires coordination between all the nodes ofthe subnet, rather than just the nodes sharing acommon media such as in multiaccess protocols

The routing system must cope with link and nodefailures, redirecting traffic and updating the databasesmaintained by the system

To achieve high performance the routing algorithm mayneed to modify its routes when some areas within thenetwork become congested

We will mainly focus on selecting routes to achieve highperformance and broadcasting routing-relatedinformation

Information Networks – p.2/35

Page 3: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Routing

The two main functions performed by a routingalgorithm are the selection of routes for various sourceand destination pairs of nodes and the delivery ofpackets to their correct destination once the routes areselected

This second function is performed by using a variety ofprotocols and data structures (routing tables)

We will focus on how to select routes and how it affectsnetwork performance

The main performance measures that are affected bythe routing algorithm is the throughput and averagepacket delay

Information Networks – p.3/35

Page 4: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Routing

Routing interacts with flow control in determining theseperformance measures, as good routing keeps thedelay low the flow control allows more traffic into thenetwork

The effect of good routing is to increase throughput forsame value of average delay under high offered loadand to decrease average delay per packet under lowand moderate load

In centralized algorithms all route choices are made ata central node, while in distributed algorithms thecomputation of routes is shared among the networknodes with information exchanged between them asnecessary

Information Networks – p.4/35

Page 5: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Routing

In static routing the path used by sessions of eachsource-destination pair is fixed regardless of trafficconditions, the routes only change in response to link ornode failure

In adaptive routing the paths used to route trafficbetween source-destination pairs change occasionallyin response to congestion

To inform nodes about changes in network topologydue to link failures and repairs it is necessary totransmit this to the entire network using a broadcast

Broadcasts can also be used as a primitive form ofrouting packets from a single transmitter to a subset ofreceivers (or possibly just one receiver)

Information Networks – p.5/35

Page 6: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Broadcasting, flooding algorithm

Broadcasting is generally rather inefficient but may besensible because it’s simple or because the receivers’location within the network is unknown

A widely used broadcasting method is flooding, thesource node sends its packet to its neighbours, theneighbours relay it to their neighbours, and so on untilthe packet has reached all nodes in the network

To limit the number of transmissions a node will notrelay the packet back to the node from which the packetwas obtained, and a node will send the packet to itsneighbours at most once; this can be ensured byincluding in the packet the origin node ID and asequence number

Information Networks – p.6/35

Page 7: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Broadcasting, flooding algorithm

The sequence number is increased with each newpacket issued by the origin node

By storing the highest sequence number received foreach origin node, and not relaying packets withsequence numbers less than or equal to the one storeda node can avoid transmitting the same packet morethan once

The total number of packet transmissions per packetbroadcast lies between L and 2L, where L is thenumber of bidirectional links in the network

There is a problem with using sequence numbers whenportions of the network become disconnected ormalfunctions

Information Networks – p.7/35

Page 8: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Broadcasting, flooding algorithm

When a complete or partial network reinitializationtakes place (perhaps following a crash of one or morenodes) it may be necessary to reset the sequencenumbers to 0, since a node may not remember thesequence number it was using before the crash

Also the sequence number could be altered in a nodedue to malfunction or erroneous transmission

Some way to reinitialize sequence numbers is needed,one way to do this is to include age field in thebroadcast packet, thus each node can calculate the ageof the information about the sequence number and usea timeout to supersede aged messages with recentones regardless of sequence value

Information Networks – p.8/35

Page 9: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Broadcasting, flooding algorithm

Aging information in combination with periodic updatesguarantees that up-to-date information will be availableeventually

The age field indicates how long the broadcast packethas been circulating in the network, a packet whoseage exceeds some limit are not transmitted further

It is also possible to use broadcast without sequencenumbers by using an algorithm that updates thetopology concurrently with the information in thebroadcast packet in a manner similar to methods we willdescribe for updating nodes with shortest pathinformation (network topology)

Information Networks – p.9/35

Page 10: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Broadcasting, spanning tree

Another broadcast method is to use a spanning tree,which is a connected subgraph of the network thatincludes all nodes and has no cycles

Broadcasting on a spanning tree is more efficient thanflooding, it requires N − 1 packet transmissions perpacket broadcast, where N is the number of nodes

The price is that we need to maintain and update thespanning tree of the network

Given a spanning tree one can perform selectivebroadcasting, that is, transmission from a source to alimited set of destinations, given that each node knowswhich of its spanning tree links lead to any givendestination

Information Networks – p.10/35

Page 11: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Shortest path routing

Many routing algorithms are based on a notion ofshortest path between two nodes

Each communication link is assigned a positive numbercalled its length, a link can have different length in eachdirection

Each path (sequence of links) has a length equal to thesum of the lengths of its links

A shortest path routing algorithm routes each packetalong a minimum length path between the source anddestination nodes

The simplest possibility is for each link to have unitlength, in which shortest path is minimum number oflinks (min-hop path)

Information Networks – p.11/35

Page 12: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Shortest path routing

The length of a link may depend on its transmissioncapacity and its projected traffic load, the idea is that ashortest path should contain relatively few anduncongested links

We may let the length of each link change over timeand depend on the current congestion level of the link,then shortest path may adapt to temporary overloadsand route packets around points of congestion

A problem with this is that it introduces a feedbackleading to instability of routing and oscillation ofselected routes

Information Networks – p.12/35

Page 13: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Shortest path routing

It is possible to damp these oscillations by adding apositive constant to the link lengths, this constant isknown as a bias factor

If the bias factor is large enough relative to the range oflink lengths, the shortest path will be the min-hop pathwhich is a static routing and cannot exhibit anyoscillation and is totally insensitive to traffic congestion

A possibility is to set the bias to the sum of averagepacket transmission time, processing delay andpropagation delay of a link

Another possibility is to damp oscillations by averaginglink lengths over a longer period than shortest pathupdates

Information Networks – p.13/35

Page 14: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Interconnected Network Routing

When interconnecting networks various interfacedevices are used, in the case of wide-area networksthey are called gateways

The gateways perform fairly sophisticated networktasks including routing and operate at the Internetsublayer of the network layer

When interconnecting local area networks (LAN) it ispossible to do it at the MAC sublayer with a primitiveform of routing, these devices are called bridges

LANs can also be connected with each other or widearea networks using more sophisticated devices calledrouters

Information Networks – p.14/35

Page 15: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Interconnected Network Routing

Routers provide fairly advanced routing functions atnetwork layer, possibly including adaptive andmultiple-path routing

One may view an interconnected network of subnets asa single large network where the interfaces (gateways,bridges, routers) are just additional nodes connected totwo or more subnets

Routing based on this model is called nonhierarchicaland similar to routing in a wide area network

It is also possible to view each subnet as a single nodeconnected to interface nodes, this model is calledhierarchical and consists of at least two levels

Information Networks – p.15/35

Page 16: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Hierarchical Routing

At the lowest level there is a separate routing algorithmfor each subnet that handles local subnet traffic anddirects internetwork traffic to the subnets interface withthe other subnets

At the higher level there is a routing algorithm thatdecides the sequence of subnets and interface nodesthat each internetwork packet must follow

In nonhierarchical routing each node has a unique entryin its routing table for every destination, thus the size ofthe routing tables is equal to the total number of nodesin the network, the size of routing tables andcalculations to update them may soon becomeexcessive

Information Networks – p.16/35

Page 17: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

As we saw when analyzing multiaccess protocols theperformance tends to degrade as the number of usersincreases

In Ethernet-based LANs the performance alsodegrades as the ratio of propagation delay totransmission capacity increases

A solution is to interconnect several LANs so that alarger geographical area and many users can behandled without severe performance degradation

All nodes, including the interface node hears all trafficon a LAN

Information Networks – p.17/35

Page 18: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

A bridge listens to all packets transmitted within two ormore LANs through connections called ports

The bridge then selectively relays some packets fromone LAN to another, packets can travel from source todestination going through a sequence of LANs andbridges

The resulting internetwork is nonhierarchical and canbe viewed as a single network called the extended LAN

Bridges uses some special routing techniques, the twomost common are spanning tree routing and sourcerouting

Information Networks – p.18/35

Page 19: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

Each node in the extended LAN has a unique ID, butthe ID need not contain information about which LAN itis connected to

The location of a node is assumed unknown to allownodes to be turned on and off and to be moved fromone LAN to another at will

In spanning tree method, the bridge uses a spanningtree to determine whether and to which LAN it shouldrelay a packet

The spanning tree consists of a subset of ports thatconnect all LANs into a network with no cycles, eachlink separates the tree into two parts, this yields aunique path from every LAN to every other LAN on thespanning tree

Information Networks – p.19/35

Page 20: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

The ports on the spanning tree are called designated oractive ports, and the unique paths between ports areused for all communication between LANs

Each bridge can communicate with any given nodethrough a unique active port, so it is sufficient for thebridge to keep a list of nodes for each active port, this iscalled the forwarding database (FDB) of the port

When a packet is heard on the LAN corresponding toan active port A of a bridge, if the destination ID isincluded in the FDB of an active port B different from Athe packet is transmitted on the LAN connected to B

Information Networks – p.20/35

Page 21: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

If the packet is included on the FDB of port A it isdiscarded by the bridge

The updating of the FDBs are done with bridgelearning, each active port adds to its FDB the source IDof packets transmitted on the corresponding LAN

Also each active port deletes from its FDB the ID ofnodes whose packets haven’t been transmitted on thecorresponding LAN for a while

When the destination ID is unknown at each of thebridges active ports the bridge relays the packet on allother active ports

Information Networks – p.21/35

Page 22: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bridged LANs

To build the spanning tree usually a shortest path fromevery LAN and bridge to a particular destination (root)is used

The bridges can have unique IDs and the one withsmallest ID can be selected to be root

A bridge must periodically initiate a spanning treeconstruction algorithm if it views itself as root, to copewith failure of the root node bridges periodicallybroadcast a special “hello” message to other bridges

Source routing is an alternative, the idea is to discovera route and include the route explicitly on the header ofeach packet

Information Networks – p.22/35

Page 23: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Undirected Graphs

A graph G = (N ,A) is a finite nonempty set N of nodesand a collection A of arcs consisting of pairs of distinctnodes from N

A walk in G is a sequence of nodes (n1, n2, . . . , nl) suchthat each of the pairs (ni, ni+1), i = 1, . . . , l − 1 are arcsof G

A walk with no repeated nodes are a path

A walk (n1, n2, . . . , nl) with n1 = nl, l > 3 and norepeated nodes other that n1 = nl is a cycle

A graph is connected if for each node i there is a path(i = n1, n2, . . . , nl = j) to each other node j

Information Networks – p.23/35

Page 24: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Undirected Graphs

If G is a connected graph and S any nonempty strictsubset of the set N of nodes of G then at least one arc(i, j) exists with i ∈ S and j 6∈ S

If G′ = (N ′,A′) and G == (N ,A) are graphs andN ′ ⊂ N and A′ ⊂ A then we say that G′ is a subgraphof G

A tree is a connected graph that contains no cycles

A spanning tree of a graph G is a subgraph of G that isa tree and includes all nodes of G

We can construct a spanning tree by starting with anarbitrary node and no arcs and successively adding anarc from the nodes added so far to a new node and alsothat new node

Information Networks – p.24/35

Page 25: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Undirected Graphs

The spanning tree of a connected graph G has N nodesand N − 1 arcs if G has N nodes, and N − 1 is the leastnumber of arcs for a connected subgraph of G, and anyconnected graph with N nodes and N − 1 arcs is a tree,if G has more than N − 1 arcs then G contains a cycleand is not a tree

If we have weights wij for each arc (i, j) we canconsider a minimum weight spanning tree (MST) whichis a spanning tree with minimum sum of arc weights

If the arc weights represent the cost of sending a packetalong the link corresponding to an arc in either directionthen the total spanning tree weight represents the costof broadcasting a message to all nodes along thespanning tree

Information Networks – p.25/35

Page 26: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

MST algorithms

Any subtree of a MST is called a fragment, this includesa node by itself with no arcs

An arc having one node in a fragment and the othernode not in this fragment is called an outgoing arc fromthe fragment

If F is a fragment and α = (i, j) is a minimum weightoutgoing arc from F , where j is not in F , then F

extended by arc α and node j is a fragment

This fact can be used for making MST constructionalgorithms

Prim-Dijkstra algorithm starts with an arbitrarily selectedsingle node as a fragment and enlarges the fragmentsuccessively by adding a minimum weight outgoing arc

Information Networks – p.26/35

Page 27: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

MST algorithms

Kruskal’s algorithm starts with each node being a singlenode fragment and then successively combines two ofthe fragments by using the arc with minimum weight ofthose that when added do not form a cycle

If there is a unique MST we can add minimum weightoutgoing arcs simultaneously to each fragment in adistributed manner, it is not even necessary that theprocedure for arc addition is synchronized for allfragments (as long as the arc added is indeed aminimum weight outgoing arc from for one of thefragments joined)

What is needed is a scheme for the nodes and arcs of afragment to determine the minimum weight outgoing arc

Information Networks – p.27/35

Page 28: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

MST algorithms

If all arc weights are distinct there exists a unique MST,but we can make arc weights distinct by including thenode numbers of the arc in comparing the weight

If arcs (i, j) and (k, l) with i < j and k < l have sameweight we say that (i, j) has lower weight if i < k or ifi = k and j < l and otherwise (k, l) has lower weight

Information Networks – p.28/35

Page 29: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Digraphs

A directed graph or digraph G = (N ,A) is a finitenonempty set N of nodes and a collection A of directedarcs consisting of ordered pairs of distinct nodes fromN

To each digraph there is an associated undirectedgraph G′ = (N ′,A′) where N ′ = N and (i, j) ∈ A′ ifeither (i, j) ∈ A or (j, i) ∈ A, or both

We say that (n1, n2, . . . , nl) is a walk, path or cycle in adigraph if it is a walk, path or cycle in the associatedgraph

Further (n1, n2, . . . , nl) is a directed walk in a digraph G

if (ni, ni+1) is a directed arc in G for i = 1, . . . , l − 1

Information Networks – p.29/35

Page 30: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Digraphs

A directed path is a directed walk with no repeatednodes, and a directed cycle is a directed walk whenl > 2 and n1 = nl but no other repeated nodes

A digraph is strongly connected if for each pair of nodesi and j there is a directed path from i to j

A digraph is connected if the associated graph isconnected

For a digraph G in which each directed arc (i, j) isassigned some length dij the length of a directed pathp = (i, j, k, . . . , l,m) is dij + djk + . . . + dlm, and the lengthof a directed walk or cycle is defined analogously

Information Networks – p.30/35

Page 31: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Shortest paths

Given any two nodes i,m of a digraph the shortest pathproblem is finding a minimum length directed path fromi to m

If dij is the cost of using a link (i, j) then the shortestpath from i to m is the minimum cost route over whichto send data

If dij is average packet delay across the link theshortest path is the minimum delay route, unfortunatelythe average delay of a link depends on the traffic loadcarried by the link which depends on the routesselected

If pij is the probability that arc (i, j) is usable, and eacharc is usable independent of all the other arcs thenshortest path with dij = − log pij is the most reliable path

Information Networks – p.31/35

Page 32: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bellman-Ford algorithm

We suppose that node 1 is the destination and considerthe problem of finding a shortest path from every nodeto node 1

We denote dij = ∞ if (i, j) is not an arc of the graph,with this convention we can assume that there is an arcbetween any pair of nodes

A shortest walk from node i to node 1 subject to theconstraint that the walk contains at most h arcs andgoes through node 1 only once is the shortest (≤ h)

walk and its length is denoted Dhi

We let Dh1 = 0 for all h

Information Networks – p.32/35

Page 33: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Bellman-Ford algorithm

We can generate Dhi recursively by

Dh+1i = min

j[dij + Dh

j ], for all i 6= 1

starting from D0i = ∞ for all i 6= 1

The algorithm terminates after h iterations if Dhi = Dh−1

i

for all i

The algorithm terminates after a finite number of stepsif and only if all cycles not containing 1 havenonnegative length. If the algorithm terminates it doesso after at most h ≤ N iterations

Information Networks – p.33/35

Page 34: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Dijkstra’s algorithm

This algorithm requires that all arc lengths arenonnegative, it’s worst case computationalrequirements are less than for Bellman-Ford

We label each node with a tentative distance Di of theshortest path length, and call the nodes permanentlylabeled when the tentative distance becomes certain

Start with P = {1}, D1 = 0, Dj = dj1 for j 6= 1

Find closest node i 6∈ P such that Di = minj 6∈P Dj

Set P := P ∪ {i}, if P contains all nodes we are done

Otherwise we update the labels by for all j 6∈ P setDj := min[Dj , dji + Di] and repeat finding closest node

Information Networks – p.34/35

Page 35: Routing - Linköping University · Routing Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess

Floyd-Warshall algorithm

Computes shortest path between all pairs of nodes, likeBellman-Ford arc distances can be positive or negativebut there can be no negative-length cycles

This algorithm iterates on the set of nodes that areallowed as intermediate

Let Dnij be the shortest path length from node i to j

using only nodes 1, 2, . . . , n as intermediate nodes onpaths

Initially D0ij = dij for all i, j, i 6= j

For n = 0, 1, . . . , N − 1 letDn+1

ij = min[Dnij , D

ni(n+1) + Dn

(n+1)j ] for all i 6= j

Information Networks – p.35/35