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 Routing requires coordination between all the nodes of the subnet, rather than just the nodes sharing a common media such as in multiaccess protocols The routing system must cope with link and node failures, redirecting traffic and updating the databases maintained by the system To achieve high performance the routing algorithm may need to modify its routes when some areas within the network become congested We will mainly focus on selecting routes to achieve high performance and broadcasting routing-related information Information Networks p.2/35
Routing The two main functions performed by a routing algorithm are the selection of routes for various source and destination pairs of nodes and the delivery of packets to their correct destination once the routes are selected This second function is performed by using a variety of protocols and data structures (routing tables) We will focus on how to select routes and how it affects network performance The main performance measures that are affected by the routing algorithm is the throughput and average packet delay Information Networks p.3/35
Routing Routing interacts with flow control in determining these performance measures, as good routing keeps the delay low the flow control allows more traffic into the network The effect of good routing is to increase throughput for same value of average delay under high offered load and to decrease average delay per packet under low and moderate load In centralized algorithms all route choices are made at a central node, while in distributed algorithms the computation of routes is shared among the network nodes with information exchanged between them as necessary Information Networks p.4/35
Routing In static routing the path used by sessions of each source-destination pair is fixed regardless of traffic conditions, the routes only change in response to link or node failure In adaptive routing the paths used to route traffic between source-destination pairs change occasionally in response to congestion To inform nodes about changes in network topology due to link failures and repairs it is necessary to transmit this to the entire network using a broadcast Broadcasts can also be used as a primitive form of routing packets from a single transmitter to a subset of receivers (or possibly just one receiver) Information Networks p.5/35
Broadcasting, flooding algorithm Broadcasting is generally rather inefficient but may be sensible because it s simple or because the receivers location within the network is unknown A widely used broadcasting method is flooding, the source node sends its packet to its neighbours, the neighbours relay it to their neighbours, and so on until the packet has reached all nodes in the network To limit the number of transmissions a node will not relay the packet back to the node from which the packet was obtained, and a node will send the packet to its neighbours at most once; this can be ensured by including in the packet the origin node ID and a sequence number Information Networks p.6/35
Broadcasting, flooding algorithm The sequence number is increased with each new packet issued by the origin node By storing the highest sequence number received for each origin node, and not relaying packets with sequence numbers less than or equal to the one stored a node can avoid transmitting the same packet more than once The total number of packet transmissions per packet broadcast lies between L and 2L, where L is the number of bidirectional links in the network There is a problem with using sequence numbers when portions of the network become disconnected or malfunctions Information Networks p.7/35
Broadcasting, flooding algorithm When a complete or partial network reinitialization takes place (perhaps following a crash of one or more nodes) it may be necessary to reset the sequence numbers to 0, since a node may not remember the sequence number it was using before the crash Also the sequence number could be altered in a node due to malfunction or erroneous transmission Some way to reinitialize sequence numbers is needed, one way to do this is to include age field in the broadcast packet, thus each node can calculate the age of the information about the sequence number and use a timeout to supersede aged messages with recent ones regardless of sequence value Information Networks p.8/35
Broadcasting, flooding algorithm Aging information in combination with periodic updates guarantees that up-to-date information will be available eventually The age field indicates how long the broadcast packet has been circulating in the network, a packet whose age exceeds some limit are not transmitted further It is also possible to use broadcast without sequence numbers by using an algorithm that updates the topology concurrently with the information in the broadcast packet in a manner similar to methods we will describe for updating nodes with shortest path information (network topology) Information Networks p.9/35
Broadcasting, spanning tree Another broadcast method is to use a spanning tree, which is a connected subgraph of the network that includes all nodes and has no cycles Broadcasting on a spanning tree is more efficient than flooding, it requires N 1 packet transmissions per packet broadcast, where N is the number of nodes The price is that we need to maintain and update the spanning tree of the network Given a spanning tree one can perform selective broadcasting, that is, transmission from a source to a limited set of destinations, given that each node knows which of its spanning tree links lead to any given destination Information Networks p.10/35
Shortest path routing Many routing algorithms are based on a notion of shortest path between two nodes Each communication link is assigned a positive number called its length, a link can have different length in each direction Each path (sequence of links) has a length equal to the sum of the lengths of its links A shortest path routing algorithm routes each packet along a minimum length path between the source and destination nodes The simplest possibility is for each link to have unit length, in which shortest path is minimum number of links (min-hop path) Information Networks p.11/35
Shortest path routing The length of a link may depend on its transmission capacity and its projected traffic load, the idea is that a shortest path should contain relatively few and uncongested links We may let the length of each link change over time and depend on the current congestion level of the link, then shortest path may adapt to temporary overloads and route packets around points of congestion A problem with this is that it introduces a feedback leading to instability of routing and oscillation of selected routes Information Networks p.12/35
Shortest path routing It is possible to damp these oscillations by adding a positive constant to the link lengths, this constant is known as a bias factor If the bias factor is large enough relative to the range of link lengths, the shortest path will be the min-hop path which is a static routing and cannot exhibit any oscillation and is totally insensitive to traffic congestion A possibility is to set the bias to the sum of average packet transmission time, processing delay and propagation delay of a link Another possibility is to damp oscillations by averaging link lengths over a longer period than shortest path updates Information Networks p.13/35
Interconnected Network Routing When interconnecting networks various interface devices are used, in the case of wide-area networks they are called gateways The gateways perform fairly sophisticated network tasks including routing and operate at the Internet sublayer of the network layer When interconnecting local area networks (LAN) it is possible to do it at the MAC sublayer with a primitive form of routing, these devices are called bridges LANs can also be connected with each other or wide area networks using more sophisticated devices called routers Information Networks p.14/35
Interconnected Network Routing Routers provide fairly advanced routing functions at network layer, possibly including adaptive and multiple-path routing One may view an interconnected network of subnets as a single large network where the interfaces (gateways, bridges, routers) are just additional nodes connected to two or more subnets Routing based on this model is called nonhierarchical and similar to routing in a wide area network It is also possible to view each subnet as a single node connected to interface nodes, this model is called hierarchical and consists of at least two levels Information Networks p.15/35
Hierarchical Routing At the lowest level there is a separate routing algorithm for each subnet that handles local subnet traffic and directs internetwork traffic to the subnets interface with the other subnets At the higher level there is a routing algorithm that decides the sequence of subnets and interface nodes that each internetwork packet must follow In nonhierarchical routing each node has a unique entry in its routing table for every destination, thus the size of the routing tables is equal to the total number of nodes in the network, the size of routing tables and calculations to update them may soon become excessive Information Networks p.16/35
Bridged LANs As we saw when analyzing multiaccess protocols the performance tends to degrade as the number of users increases In Ethernet-based LANs the performance also degrades as the ratio of propagation delay to transmission capacity increases A solution is to interconnect several LANs so that a larger geographical area and many users can be handled without severe performance degradation All nodes, including the interface node hears all traffic on a LAN Information Networks p.17/35
Bridged LANs A bridge listens to all packets transmitted within two or more LANs through connections called ports The bridge then selectively relays some packets from one LAN to another, packets can travel from source to destination going through a sequence of LANs and bridges The resulting internetwork is nonhierarchical and can be viewed as a single network called the extended LAN Bridges uses some special routing techniques, the two most common are spanning tree routing and source routing Information Networks p.18/35
Bridged LANs Each node in the extended LAN has a unique ID, but the ID need not contain information about which LAN it is connected to The location of a node is assumed unknown to allow nodes to be turned on and off and to be moved from one LAN to another at will In spanning tree method, the bridge uses a spanning tree to determine whether and to which LAN it should relay a packet The spanning tree consists of a subset of ports that connect all LANs into a network with no cycles, each link separates the tree into two parts, this yields a unique path from every LAN to every other LAN on the spanning tree Information Networks p.19/35
Bridged LANs The ports on the spanning tree are called designated or active ports, and the unique paths between ports are used for all communication between LANs Each bridge can communicate with any given node through a unique active port, so it is sufficient for the bridge to keep a list of nodes for each active port, this is called the forwarding database (FDB) of the port When a packet is heard on the LAN corresponding to an active port A of a bridge, if the destination ID is included in the FDB of an active port B different from A the packet is transmitted on the LAN connected to B Information Networks p.20/35
Bridged LANs If the packet is included on the FDB of port A it is discarded by the bridge The updating of the FDBs are done with bridge learning, each active port adds to its FDB the source ID of packets transmitted on the corresponding LAN Also each active port deletes from its FDB the ID of nodes whose packets haven t been transmitted on the corresponding LAN for a while When the destination ID is unknown at each of the bridges active ports the bridge relays the packet on all other active ports Information Networks p.21/35
Bridged LANs To build the spanning tree usually a shortest path from every LAN and bridge to a particular destination (root) is used The bridges can have unique IDs and the one with smallest ID can be selected to be root A bridge must periodically initiate a spanning tree construction algorithm if it views itself as root, to cope with failure of the root node bridges periodically broadcast a special hello message to other bridges Source routing is an alternative, the idea is to discover a route and include the route explicitly on the header of each packet Information Networks p.22/35
Undirected Graphs A graph G = (N, A) is a finite nonempty set N of nodes and a collection A of arcs consisting of pairs of distinct nodes from N A walk in G is a sequence of nodes (n 1, n 2,..., n l ) such that each of the pairs (n i, n i+1 ), i = 1,..., l 1 are arcs of G A walk with no repeated nodes are a path A walk (n 1, n 2,..., n l ) with n 1 = n l, l > 3 and no repeated nodes other that n 1 = n l is a cycle A graph is connected if for each node i there is a path (i = n 1, n 2,..., n l = j) to each other node j Information Networks p.23/35
Undirected Graphs If G is a connected graph and S any nonempty strict subset of the set N of nodes of G then at least one arc (i, j) exists with i S and j S If G = (N, A ) and G == (N, A) are graphs and N N and A A then we say that G is a subgraph of G A tree is a connected graph that contains no cycles A spanning tree of a graph G is a subgraph of G that is a tree and includes all nodes of G We can construct a spanning tree by starting with an arbitrary node and no arcs and successively adding an arc from the nodes added so far to a new node and also that new node Information Networks p.24/35
Undirected Graphs The spanning tree of a connected graph G has N nodes and N 1 arcs if G has N nodes, and N 1 is the least number of arcs for a connected subgraph of G, and any connected graph with N nodes and N 1 arcs is a tree, if G has more than N 1 arcs then G contains a cycle and is not a tree If we have weights w ij for each arc (i, j) we can consider a minimum weight spanning tree (MST) which is a spanning tree with minimum sum of arc weights If the arc weights represent the cost of sending a packet along the link corresponding to an arc in either direction then the total spanning tree weight represents the cost of broadcasting a message to all nodes along the spanning tree Information Networks p.25/35
MST algorithms Any subtree of a MST is called a fragment, this includes a node by itself with no arcs An arc having one node in a fragment and the other node not in this fragment is called an outgoing arc from the fragment If F is a fragment and α = (i, j) is a minimum weight outgoing 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 construction algorithms Prim-Dijkstra algorithm starts with an arbitrarily selected single node as a fragment and enlarges the fragment successively by adding a minimum weight outgoing arc Information Networks p.26/35
MST algorithms Kruskal s algorithm starts with each node being a single node fragment and then successively combines two of the fragments by using the arc with minimum weight of those that when added do not form a cycle If there is a unique MST we can add minimum weight outgoing arcs simultaneously to each fragment in a distributed manner, it is not even necessary that the procedure for arc addition is synchronized for all fragments (as long as the arc added is indeed a minimum weight outgoing arc from for one of the fragments joined) What is needed is a scheme for the nodes and arcs of a fragment to determine the minimum weight outgoing arc Information Networks p.27/35
MST algorithms If all arc weights are distinct there exists a unique MST, but we can make arc weights distinct by including the node numbers of the arc in comparing the weight If arcs (i, j) and (k, l) with i < j and k < l have same weight we say that (i, j) has lower weight if i < k or if i = k and j < l and otherwise (k, l) has lower weight Information Networks p.28/35
Digraphs A directed graph or digraph G = (N, A) is a finite nonempty set N of nodes and a collection A of directed arcs consisting of ordered pairs of distinct nodes from N To each digraph there is an associated undirected graph G = (N, A ) where N = N and (i, j) A if either (i, j) A or (j, i) A, or both We say that (n 1, n 2,..., n l ) is a walk, path or cycle in a digraph if it is a walk, path or cycle in the associated graph Further (n 1, n 2,..., n l ) is a directed walk in a digraph G if (n i, n i+1 ) is a directed arc in G for i = 1,..., l 1 Information Networks p.29/35
Digraphs A directed path is a directed walk with no repeated nodes, and a directed cycle is a directed walk when l > 2 and n 1 = n l but no other repeated nodes A digraph is strongly connected if for each pair of nodes i and j there is a directed path from i to j A digraph is connected if the associated graph is connected For a digraph G in which each directed arc (i, j) is assigned some length d ij the length of a directed path p = (i, j, k,..., l, m) is d ij + d jk +... + d lm, and the length of a directed walk or cycle is defined analogously Information Networks p.30/35
Shortest paths Given any two nodes i, m of a digraph the shortest path problem is finding a minimum length directed path from i to m If d ij is the cost of using a link (i, j) then the shortest path from i to m is the minimum cost route over which to send data If d ij is average packet delay across the link the shortest path is the minimum delay route, unfortunately the average delay of a link depends on the traffic load carried by the link which depends on the routes selected If p ij is the probability that arc (i, j) is usable, and each arc is usable independent of all the other arcs then shortest path with d ij = log p ij is the most reliable path Information Networks p.31/35
Bellman-Ford algorithm We suppose that node 1 is the destination and consider the problem of finding a shortest path from every node to node 1 We denote d ij = if (i, j) is not an arc of the graph, with this convention we can assume that there is an arc between any pair of nodes A shortest walk from node i to node 1 subject to the constraint that the walk contains at most h arcs and goes through node 1 only once is the shortest ( h) walk and its length is denoted D h i We let D h 1 = 0 for all h Information Networks p.32/35
Bellman-Ford algorithm We can generate D h i recursively by D h+1 i starting from D 0 i = min j [d ij + D h j ], for all i 1 = for all i 1 The algorithm terminates after h iterations if D h i = Dh 1 i for all i The algorithm terminates after a finite number of steps if and only if all cycles not containing 1 have nonnegative length. If the algorithm terminates it does so after at most h N iterations Information Networks p.33/35
Dijkstra s algorithm This algorithm requires that all arc lengths are nonnegative, it s worst case computational requirements are less than for Bellman-Ford We label each node with a tentative distance D i of the shortest path length, and call the nodes permanently labeled when the tentative distance becomes certain Start with P = {1}, D 1 = 0, D j = d j1 for j 1 Find closest node i P such that D i = min j P D j Set P := P {i}, if P contains all nodes we are done Otherwise we update the labels by for all j P set D j := min[d j, d ji + D i ] and repeat finding closest node Information Networks p.34/35
Floyd-Warshall algorithm Computes shortest path between all pairs of nodes, like Bellman-Ford arc distances can be positive or negative but there can be no negative-length cycles This algorithm iterates on the set of nodes that are allowed as intermediate Let Dij n be the shortest path length from node i to j using only nodes 1, 2,..., n as intermediate nodes on paths Initially D 0 ij = d ij for all i, j, i j For n = 0, 1,..., N 1 let Dij n+1 = min[dij n, Dn i(n+1) + Dn (n+1)j] for all i j Information Networks p.35/35