# Understanding Network Routing Problem and Study of Routing Algorithms and Heuristics through Implementation # I. INTRODUCTION he transport layer provides communication service between two processes running on two different hosts. In order to provide this service, the transport layer relies on the services of the network layer, which provides a communication service between hosts. In particular, the network-layer moves transport-layer segments from one host to another. At the sending host, the transport layer segment is passed to the network layer. In order to this, the network layer requires the coordination of each and every host and router in the network. In simple terms, if we have to define Routing in a lay man's language we can simply say that Routing is the manner/order in which we decide the path a segment shall follow from the sending host to the receiving one. This path includes a connection of links and routers. In technical terms though routing is a complex yet challenging concept. Technically, Routing broadly consists of the following 3 functions: 1. Path Determination: This function determines the path/route the packets will follow from the sender to receiver. It involves various routing algorithms which are discussed further. 2. Switching: When a packet arrives at a router it needs to be further dispatched to other routers i.e. it is further switched to other routers. 3. Call Setup: Just like a TCP carries out 3 -way handshake similarly some network layer architectures (e.g., ATM) requires that the routers along the chosen path from source to destination handshake with each other in order to setup state before data actually begins to flow. In the network layer, this process is referred to as call setup. The main goals of routing are: Correctness: The routing should be done properly and correctly so that the packets may reach their proper destination. Simplicity: The routing should be done in a simple manner so that the overhead is as low as possible. With increasing complexity of the routing algorithms the overhead also increases. Robustness: Once a major network becomes operative, it may be expected to run continuously for years without any failures. The algorithms designed for routing should be robust enough to handle hardware and software failures and should be able to cope with changes in the topology and traffic without requiring all jobs in all hosts to be aborted and the network rebooted every time some router goes down. # Stability: The routing algorithms should be stable under all possible conditions. Fairness: Every node connected to the network should get a fair chance of transmitting their packets. This is generally done on a first come first serve basis. Optimality: The routing algorithms should be optimal in terms of throughput and minimizing mean packet delays. Here there is a trade-off and one has to choose depending on his suitability. # Connected devices through routers Routing is performed for many kinds of networks, including the telephone network (circuit switching), electronic data networks (such as the Internet), and transportation networks. This article is concerned primarily with routing in electronic data networks using packet switching technology. In packet switching networks, routing directs packet forwarding (the transit of logically addressed network packets from their source toward their ultimate destination) through intermediate nodes. Intermediate nodes are typically network hardware devices such as routers, bridges, gateways, firewalls, or switches. General purpose computers can also forward packets and perform routing, though they are not specialized hardware and may suffer from limited performance. The routing process usually directs forwarding on the basis of routing tables, which maintain a record of the routes to various network destinations. Thus, constructing routing tables, which are held in the router's memory, is very important for efficient routing. Most routing algorithms use only one network path at a time. Multipath routing techniques enable the use of multiple alternative paths. In case of overlapping/equal routes, algorithms consider the following elements to decide which routes to install into the routing table (sorted by priority): Prefix-Length: where longer subnet masks are preferred (independent of whether it is within a routing protocol or over different routing protocol). Metric: where a lower metric/cost is preferred (only valid within one and the same routing protocol). Administrative Distance: where a route learned from a more reliable routing protocol is preferred (only valid between different routing protocols). Link-state routing protocols are one of the two main classes of routing protocols used in packet switching networks for computer communications, the other being distance-vector routing protocols. Examples of link-state routing protocols include open shortest path first (OSPF) and intermediate system to intermediate system (IS-IS).The link-state protocol is performed by every switching node in the network (i.e., nodes that are prepared to forward packets; in the Internet, these are called routers). The basic concept of link-state routing is that every node constructs a map of the connectivity to the network, in the form of a graph, showing which nodes are connected to which other nodes. Each node then independently calculates the next best logical path from it to every possible destination in the network. The collection of best paths will then form the node's routing table. This contrasts with distance-vector routing protocols, which work by having each node share its routing table with its neighbours. In a link-state protocol the only information passed between nodes is connectivity related. # II. RESEARCH ELABORATION Strategy used: Greedy programming, generally a variant of Dijkstra's algorithm is used. # ii. Distance vector routing In computer communication theory relating to packet-switched networks, a distance-vector routing protocol is one of the two major classes of intra domain routing protocols, the other major class being the link-state protocol. Distance-vector routing protocols use the Bellman-Ford algorithm, Ford-Fulkerson algorithm, or DUAL FSM (in the case of Cisco Systems's protocols) to calculate paths. A distance-vector routing protocol requires that a router inform its neighbors of topology changes periodically. Compared to link-state protocols, which require a router to inform all the nodes in a network of topology changes, distance-vector routing protocols have less computational complexity and message overhead. The term distance vector refers to the fact that the protocol manipulates vectors (arrays) of distances to other nodes in the network. The vector distance algorithm was the original ARPANET routing algorithm and was also used in the internet under the name of RIP (Routing Information Protocol).Examples of distance-vector routing protocols include RIPv1 and IGRP. Strategy used: Dynamic programming, generally bellman ford algorithm. # Fig.1: c) Common Routing Algorithms The shortest paths are calculated using suitable algorithms on the graph representations of the networks. Let the network be represented by graph G (V, E ) and let the number of nodes be 'N'. For all the algorithms discussed below, the costs associated with the links are assumed to be positive. A node has zero cost w.r.t itself. Further, all the links are assumed to be symmetric, i.e. if di,j = cost of link from node i to node j, then d i,j = d j,i . The graph is assumed to be complete. If there exists no edge between two nodes, then a link of infinite cost is assumed. The algorithms given below find costs of the paths from all nodes to a particular node; the problem is equivalent to finding the cost of paths from a source to all destinations. # d) Bellman-Ford Algorithm This algorithm iterates on the number of edges in a path to obtain the shortest path. Since the number of hops possible is limited (cycles are implicitly not allowed), the algorithm terminates giving the shortest path. # Principle: i. Dijkstra's Algorithm Notation: Di = Length of shortest path from node 'i' to node 1. di,j = Length of path between nodes i and j . # Algorithm: Principle: Let the closest node to 1 at some step be i. Then i is shifted to P. Now, for each node j, the closest path to 1 either passes through i or it doesn't. In the first case Dj remains the same. In the second case, the revised estimate of Dj is the sum Di + di,j . So we take the minimum of these two cases and update Dj accordingly. As each of the nodes get transferred to set P, the estimates get closer to the lowest possible value. When a node is transferred, its shortest path length is known. So finally all the nodes are in P and the Dj 's represent the minimum costs. The algorithm is guaranteed to terminate in N-1 iterations and its complexity is O( N2 ). # e) The Floyd Warshall Algorithm This algorithm iterates on the set of nodes that can be used as intermediate nodes on paths. This set grows from a single node (say node 1) at start to finally all the nodes of the graph. At each iteration, we find the shortest path using given set of nodes as intermediate nodes, so that finally all the shortest paths are obtained. It is observed that all the three algorithms mentioned above give comparable performance, depending upon the exact topology of the network. # III. RESULTS AND FINDINGS a) Performance metrics for comparision Router metrics are metrics used by a router to make routing decisions. It is typically one of many fields in a routing table. Metrics are used to determine whether one route should be chosen over another. The routing table stores possible routes, while link-state or topological databases may store all other information as well. For example, Routing Information Protocol uses hopcount (number of hops) to determine the best possible route. The route will go in Iteration: D[i,h+1]=min {di, j+ D [j, h]}over all values of j Each node j is labeled with Dj, which is an estimate of cost of path from node j to node 1. Initially, let the estimates be infinity, indicating that nothing is known about the paths. We now iterate on the length of paths, each time revising our estimate to lower values, as we obtain them. Actually, we divide the nodes into two groups; the first one, called set P contains the nodes whose shortest distances have been found, and the other Q containing all the remaining nodes. Initially P contains only the node 1. At each step, we select the node that has minimum cost path to node 1. This node is transferred to set P. At the first step, this corresponds to shifting the node closest to 1 in P. Its minimum cost to node 1 is now known. At the next step, select the next closest node from set Q and update the labels corresponding to each node using: Dj = min [ Dj, Di + dj, i ]. After N-1 iterations, shortest paths for all nodes are known, and the algorithm terminates after completing these many iterations. For zero hops, the minimum length path has length of infinity, for every node. For one hop the shortest-path length associated with a node is equal to the length of the edge between that node and node 1. Hereafter, we increment the number of hops allowed, (from h to h+1) and find out whether a shorter path exists through each of the other nodes. If it exists, say through node 'j', then its length must be the sum of the lengths between these two nodes (i.e. di, j ) and the shortest path between j and 1 obtainable in upto h paths. If such a path doesn't exist, then the path length remains the same. The algorithm is guaranteed to terminate, since there are utmost N nodes, and so N-1 paths. It has time complexity of O (N3). the direction of the gateway with the lowest metric. The direction with the lowest metric can be a default gateway. Router metrics can contain any number of values that help the router determine the best route among multiple routes to a destination. A router metric typically based on information like path length, bandwidth, load, hop count, path cost, delay, Maximum Transmission Unit (MTU), reliability and communications cost. A Metric can include: 1. measuring link utilization (using SNMP) 2. number of hops (hop count) 3. speed of the path 4. packet loss (router congestion/conditions) 5. latency (delay) 6. path reliability 7. path bandwidth 8. throughput [SNMP -query routers] 9. load 10. MTU Fig. 2: Six network evaluation criteria Throughput: In general terms, throughput is the rate of production or the rate at which something can be processed. When used in the context of computer networking, such as Ethernet or packet radio, throughput or network throughput is the rate of successful message delivery over a communication channel. The data these messages belong to may be delivered over a physical or logical link or it can pass through a certain network node/router. Throughput is usually measured in bits per second (bit/s or bps), and sometimes in data packets per second (p/s or pps).The system throughput or aggregate throughput is the sum of the data rates that are delivered to all terminals in a network. It can be analyzed mathematically by applying the queueing theory, where the load in packets per time unit is denoted as the arrival rate (?), and the throughput, in packets per time unit, is denoted as the departure rate (?). Goodput: In computer networks, good put is the application level throughput, i.e. The number of useful information bits delivered by the network to a certain destination per unit of time. The amount of data considered excludes protocol overhead bits as well as retransmitted data packets. This is related to the amount of time from the first bit of the first packet sent (or delivered) until the last bit of the last packet is delivered. For example, if a file is transferred, the good put that the user experiences corresponds to the file size in bits divided by the file transfer time. The good put is always lower than the throughput (the gross bit rate that is transferred physically), which generally is lower than network access connection speed. Network Latency: Network latency in a packetswitched network is measured either one-way (the time from the source sending a packet to the destination receiving it), or round-trip delay time (the one-way latency from source to destination plus the one-way latency from the destination back to the source). It further consists of the processing delay, queuing delay and transmission delay. The processing delay is basically the time a sender host takes to process a packet and identify the router. Once the router is identified, queuing delay is encountered when a packet has to wait in the queuing buffer before it is transferred further. Transmission delay consists of the time to transmit the packet over the link. Link Capacity: The term link capacity defines the net bit rate (aka. Peak bit rate, information rate, or physical layer useful bit rate), or the maximum throughput of a logical or physical communication path in a digital communication system. For example, bandwidth tests measure the maximum throughput of a computer network. Number of Bottlenecks: Bottleneck basically means traffic/congestion at various points in the network link. The number of bottlenecks signifies the number of place throughout the network link where a bottleneck has occurred. Traffic Intensity: In a digital network, the traffic intensity measures the ratio of the arrival rate of packets to the average packet length. Is: (al)/R where a is the average arrival rate of packets (e.g. In packets per second), L is the average packet length (e.g. In bits), and R is the transmission rate (e.g. Bits per second). Performance metrics selected for the implementation of this project: 1. Throughput 2. Delay # b) Software and Testing Environment A network simulator is software that predicts the behaviour of a computer network. Since communication Networks have become too complex for traditional analytical methods to provide an accurate understanding of system behaviour network simulator are used. In simulators, the computer network is typically modelled with devices, links, applications etc. and the performance is analysed. Simulators typically come with support for the most popular technologies and networks in use today. Most of the commercial simulators are GUI driven, while some network simulators are CLI driven. The network model/configuration describes the state of the network (nodes, routers, switches, links) and the events (data transmissions, packet error etc.). An important output of simulations are the trace files. Trace files log every packet, every event that occurred in the simulation and are used for analysis. Network simulators can also provide other tools to facilitate visual analysis of trends and potential trouble spots. Simulation of networks is a very complex task. For example, if congestion is high, then estimation of the average occupancy is challenging because of high variance. To estimate the likelihood of a buffer overflow in a network, the time required for an accurate answer can be extremely large. Specialized techniques such as "control variates" and "importance sampling" have been developed to speed simulation. The network simulator must enable a user to: 1. Model the network topology specifying the nodes on the network and the links between those nodes 2. Model the application flow (traffic) between the nodes 3. Providing network performance metrics as output 4. Visualization of the packet flow 5. Logging of packet / events for drill down analyses or debugging. The "ns-3" simulation software is built using C++ and Python with scripting capability. The ns-3 library is wrapped by Python thanks to the pybindgen library which delegates the parsing of the ns-3 C++ headers to gccxml and pygccxml to automatically generate the corresponding C++ binding glue. These automatically-generated C++ files are finally compiled into the ns-3 Python module to allow users to interact with the C++ ns-3 models and core through Python scripts. The ns-3 simulator features an integrated attribute-based system to manage default and perinstance values for simulation parameters. All of the configurable default values for parameters are managed by this system, integrated with command-line argument processing. The large majority of its users focuses on wireless simulations which involve models for Wi-Fi. # Network Topology The general process of creating a simulation can be divided into several steps: 1. Topology Definition: To ease the creation of basic facilities and define their interrelationships, ns-3 has a system of containers and helpers that facilitates this process. 2. Model Development: Models are added to simulation (for example, UDP, IPv4, point-to-point devices and links, applications); most of the time this is done using helpers. 3. Node and link configuration: Models set their default values (for example, the size of packets sent by an application or MTU of a point-to-point link); most of the time this is done using the attribute system. 4. Execution: Simulation facilities generate events, data requested by the user is logged. 5. Performance Analysis: After the simulation is finished and data is available as a time-stamped event trace. This data can then be statistically analysed with tools like R to draw conclusions. # d) Inferences From the description and comparison of performance as well as the experimental results OSPFv2 Routing Protocol (OPEN Shortest Path First version 2) and RIPv2 (Routing Information Protocol version 2) in the IPv4 network, then it can be concluded that: 1. Every router within the same routing protocols build routing tables, based on information from neighboring routers for sharing information between routers. 2. Based on the speed of delivery of the package with the parameter used is the time between networks that converge OSPFv2 routing protocols rather than RIPv2 better use. 3. RIPv2 using distance / hops while for OSPF will use the same area thus saving bandwidth usage. 4. ENSP Simulator GNS3 looks faster than the time required for inter-network converge.To wider network then it would be better to use Dijkstra routers because of its ability to divide the network area into several sections. # REFERENCES RÉFÉRENCES REFERENCIAS © 2017 Global Journals Inc. (US) 1 ![a) Algorithmic strategies used in routing 1. Brute force algorithm 2. Greedy strategy 3. Dynamic programming 4. Backtracking 5. Branch and Bound 6. Divide and Conquer 7. Decrease and Conquer 8. Transfer and Conquer b) Types of Routing Algorithms i. Link state routing](image-2.png "") ![Notation: d i,j = Length of path between nodes i and j, indicating the cost of the link. h = Number of hops. D[i,h] = Shortest path length from node i to node 1, with upto 'h' hops. D[ 1,h] = 0 for all h. Algorithm: Initial condition: D[ i, 0] = infinity, for all i ( i != 1 ) Termination: The algorithm terminates when D[i, h] = D [ i, h+1] for all i .](image-3.png "") 34![Fig. 3:](image-4.png "Fig. 3 :Fig. 4 :") ![Computer Science and Technology Volume XVII Issue V Version I Understanding Network Routing Problem and Study of Routing Algorithms and Heuristics through Implementation](image-5.png "") 5![Fig. 5:](image-6.png "Fig. 5 :") Standard Topologies: 1. Bus -Devices connected to a common, shared cable. 2. Star -Connecting computers to cable segments branch out from a single point, or hub. 3. Ring -Connecting computers to cable that form a loop. 4. Mesh -Connects all computers in a network to each other with separate cables. Types of common network topologies © 2017 Global Journals Inc. (US) 1 © 2017 Global Journals Inc. (US) ( ) * Differences Performance OSPFv2 and RIPv2 Routing Protocols In Network IPv4 Using Simulator GNS3 And ENSP LSetiawati * Simulation Based Performance Analyses on RIPv2, EIGRP, and OSPF Using OPNET BWu 2011 * A constrained shortest-path energy-aware routing algorithm for wireless sensor networks MYoussef MFYounis KArisha Wireless Communications and Networking Conference IEEE 2002. March. 2002. 2002 2 * Graph-Based Routing, Broadcasting and Organizing Algorithms for Ad-Hoc Networks LLiu JJin MPalaniswami MLiu XLi ZHuang 2012 INTECH Open Access Publisher * Intelligent routing and bandwidth allocation in wireless networks IKassabalidis AKDas MAEl-Sharkawi IIMarks RJArabshahi PGray A Proc. NASA Earth Science Technology Conf NASA Earth Science Technology ConfCollege Park, MD 2001. August. August 28 30 * Minimum Hop Energy Efficient Routing Protocol GSDevi GSKumar PVG D PReddy International Journal of Computer Applications 34 4 2011 * A Minimum Hop Routing Protocol for Wireless Sensor Networks SSChiang CHHuang KCChang * Graph's theory approach for searching the shortest routing path in RIP protocol: a case study SKlampfer JMohorko ZCucej AChowdhury PRZEGLAD ELEKTROTECHNICZNY 88 8 2012