Routing Algorithms
| Routing Algorithms
By: Roozbeh Razavi Introduction: A router is used to manage network traffic and finding the best route for packets to be sent. But have you ever thought that how routers do this? Its obvious that routers should have some information about network status, to make decision about how to send packets. But how do they gather this information? Indeed routers use “Routing algorithms” to find the best route to destination. When we say best route, we consider parameters like the number of Hops (a hop is the trip a data packet takes from one router or intermediate point to another in the network), time delay and communication cost of packet transmission. See figure 1. Figure 1 Based on how routers gather information about structure of network and their analyzation of information to specify the best route, we have two major routing algorithms: “Global routing algorithms” And “Decentralized routing algorithms”. LS algorithms: 1-Identify the routers that are physically connected to them and get their IP addresses: 2-It builds a status record set for every node of network that contains three fields:
3-It initializes the parameters of status record set (for all nodes) and set their length to Infinity, and their label as tentative. Example of using Dijkstra algorithm: 1-As you see in figure 2,the Source node (A) has been chosen as t node and so its label is permanent (we show permanent nodes with filled circles and t nodes with –> mark)
2-In this step you see that status record set of tentative nodes that have a direct link to t node, (B, C), has been changed. Also since B has less weight, it has been chosen as t node and so its label has changed to permanent. (See figure 3)
Figure 3 3-In this step like step 2,the status record set of tentative nodes that have a direct link to t node, (D, E), has been changed. Also since D has less weight, it has been chosen as t node and so its label has changed to permanent (See figure 4)
Figure 4 4-Here we don’t have any tentative node so we should just identify the next t node. Since E has the least weight, it has been chosen as t node.
Figure 5 5-E is the destination, so we shouldn’t continue. We are at end! So we have to identify the route. The previous node of E is D and previous node of D is B and its previous node is A. So the best route is ABDE. In this case the total weigh is 4 (1+2+1=4).
DV algorithms: DV algorithms are also known as Bellman-Ford routing algorithms and Ford-Fulkerson routing algorithms .In these algorithms every router has a routing table that show it the best route for any destination. Figure 6 show a typical routing table for router J |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Figure 6.A typical network graph and routing table for router J As the table says, if router J want to send packets to router D, it should send them to router H. Then when packets arrive to H, it checks its table and decided where to send packets. In DV algorithms each router has to follow these steps: 1-Count the weight of links that are directly connected to and save the information to its table 2-In a specific period of time, send its table to its neighbor routers (not for all routers) and receive their routing table. 3-Based on information in neighbors` routing table, update its own.One of the most Important problems with DV algorithms is called “Count to infinity”. Let us examine this problem with an example: Imagine a network with a graph that has been shown in figure 7.As you see in this graph, there is only one link between A and other parts of network. Figure 8 shows the routing table of all nodes. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Figure 7.Network graph and routing tables
Now imagine that the link between A and B cut. At this time B corrects its table. After specific amount of time, routers exchange their tables and so B receive c’ routing table. Since C doesn’t know what has been happened to link between A and B, says that it has a link to A with the weight of 2. (1 for C to B and 1 for B to A, because it doesn’t know B has no link to A) B receives this table and thinks there is a separate link between C and A, so it corrects its table and changes infinity to 3 (1 for B to C and 2 for C to A, as C said). After a time again routers exchange their routing table. When C receives B’ routing table it see that B has changed weight of its link to A from 1 to 3,so it update its table and changes the weight of link to A to 4 (1 for C to B and 3 for B to A, as B said). This process loops until all nodes find out that the weight of link to A is infinity. This situation is shown in figure 8.In this way experts say DV algorithms have a slow convergence rate.
Figure 8.Count to infinity problem One way for solving this problem is that when routers want to send information to their neighbors, don’t send the information that is related to destinations that that neighbors are only way to link to them. For example in this case C shouldn’t give any information to B about A. Because B is the only way to A. Hierarchical Routing: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Figure 9.Network graph and A’s routing table In hierarchical routing, routers are classified to groups known as “Regions”. Each router just has information about the routers in its region and has no information about other routers. Instead routers just save one record in their table for every other region. In this example we have classified our network to 5 regions. (See figure 10). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Figure 10.Hierarchical routing If A wants to send packets to any router in region 2 (D, E, F or G), it sends them to B and so on. As you see, in this condition routing tables can be summarized and consequently network efficiency improves. This example shows a 2 level hierarchical routing. We can also use 3 or 4 level hierarchical routing. In 3 level hierarchical routing, network classified to number of “Clusters”. Each cluster is made up number of regions that each contains a number or routers. Hierarchical routing is widely used in Internet routing and use several routing protocols. About the Author : Roozbeh Razavi is a student of electronic engineering in K.N.T University of technology. He is also translator of book “Networking Essentials Plus by Microsoft Corporation”. His studies have focused on areas of TCP/IP, routing and network security. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
No related posts.








