According to the OSI layer concept, routing, or best path selection, takes place on Layer 3 and is based on the logical address. In this post, we want to discuss some of the points in that statement.
What is Layer 3?
To make the design and troubleshooting easier and group all the vendors into a common platform to achieve compatibility and interoperability, the concept of network models was created. OSI model was one of those models, and it’s composed of seven layers, each of them playing a strict role in the data delivery process. The Layer 3, or Network Layer, is responsible for finding the right path for the data packet to reach its destination based on Logical Addresses (means addresses not really present on the network node).
But why we do need those Logical Addresses?
Despite the existence of physical addresses (like MAC addresses) on each of the network nodes, we still need to configure Logical Addresses even if we know that the delivery of the message is still based on that physical address. Logically you have to wonder why I do need to set an IP address for my host if frames are delivered to it based on its MAC address? Simply, the reason why you configure the IP addresses is efficient routing by constructing a database of entries that represent the node addresses in a summarized way (one network ID representative multiple nodes).
Yes, routing starts on your own PC with an Anding process that takes place to determine whether the communicating device is local or remote and defines the MAC address it will use to deliver the frame. You can view your PC routing table by issuing the command ROUTE PRINT on your command prompt.
Why do we need routing?
Simply, because each device is only aware of the connecting networks, so it needs to discover the remote ones. And routers are those dedicated devices that play the role of handling packets sent by network nodes to fellow nodes. To succeed in this handling process, the routers have to be aware of all the distant addresses, and this is done by constructing a forwarding database called a Routing Table. That table contains the Network IDs, the path where the router can reach them (Exit Interface, Next Hop), and the cost or distance of those routes ( Metrics).
How do we achieve routing?
The achievement of the routing process is guaranteed by the existence of all the possible networks in the routing database. You may wonder how the router can learn about all these networks! In STATIC ROUTING, it’s the administrator’s job to let the routers know about remote networks by entering them manually into the routing database. Obviously, this can only be done when we only have limited entries. Otherwise, in the case of a huge network, DYNAMIC ROUTING PROTOCOLS are used. Each of those protocols calculates the network path distance (Metric) in its own way. Some use the number of routers to cross (like RIP), some use the speed of the links to cross (like OSPF), and some use the speed and delay of the links to cross (like EIGRP).
How do we determine the best path?
In the process of constructing the routing database, the router may face the issue of selection when multiple paths are proposed to it by several fellow routers. In that case, the router asks two important questions: What’s the most trusted source? And what’s the lowest distance? Obviously, and based on what we discussed earlier on how routing protocols calculate path distance, the router uses this trust preference order:
- ITSELF (connected routes)
- The Administrator (Static routes)
- RIP routes (there are more than three dynamic routing protocols and so the preference list is much longer)
This trust preference order is called Administrative Distance.
What if the router has several possible paths to the same destination from the same routing source? Here the second question, what's the lowest distance route, acts as a tie breaker, and a distance preference order is used based on a Metric value.
Now the final case is what if the packet received by the router matches several entries in the same database? Here a third question has to be asked: What’s the most specific entry? This is determined by the using the entry with longest prefix or matching bits.
But what if the packet matches multiple entries with the same matching bits? The router load balances the packets to the possible forwarders. Meaning that if the routers receives, let’s say, twenty packets and has four different matching paths, it will divide the load (the packets) to make the routing process faster and more efficient which results in a better network performance.