Routing protocols, their types, features and functions

A protocol in simple terms is a set of rules to follow in order to achieve a desired result – hence the term ‘protocol’. Routing protocols are designed set of rules for communication to be made possible in computer networks. Primarily used by routers or layer 3 switches that incorporate routing function along with switching, routing protocols are an integral part of modern computer networks.

Once traffic reaches a router which is the edge that limits the boundary of a broadcast domain, there is a dire need to perform some sort of ‘routing’ of traffic as a single router can connect to multiple networks and all those networks can then connect to many other networks. Therefore, routing is sending traffic to a specific network that is either connected directly to the router itself or in case multiple networks sit in the path, via hopping through many other networks and where there are multiple paths to the same location, choosing the best path.

This is the exact same situation you would face if you were taking a route from one city to another. If you decide to use your GPS navigator, it is most likely that you would find multiple paths that lead you to the same destination but some would be faster than others. Each path will eventually lead you to your destination in the end but your goal most likely would be to choose the fastest path so that you can get to your destination as early as possible. This is where a router comes in to play.

Types of routing protocols:

There are two types of routing protocols, static and dynamic. Static routing protocol works exactly like the name suggests. It enforces manual creation of routes. Dynamic routing protocols on the other hand, populate the routing table of a router based on routes received dynamically.

Dynamic routing protocols are further divided into two classes:

Distance Vector
Link State

Distance vector:

Distance vector routing protocol simply uses distance to figure out which route is the best path to a given network. It manages to perform this operation by using hop-count, i.e. the distance to the destination itself.

Link State:

Link state routing protocol allows a router to build a full topology of the network based on information received from its neighbours. Each router in the same network then has the same view of the network topology along with precisely where it sits in the network.


Hybrid routing protocols combine some attributes of distance vector along with some attributes of link state routing protocols to provide an accurate state of accessibility to network destinations populated in the routing table.

List of dynamic routing protocols:

Distance Vector:


Link State:


Routing function:

A router’s primary function is to route traffic by finding the best path to a specific destination using it’s routing table. Over the internet and in many complex enterprise networks, routers frequently find themselves with multiple paths available at their behest to reach the same destination. This, therefore, invokes the need to provide them with some sort of decision making mechanism to decide which path to choose to send traffic. To achieve this a router has a default mechanism to decide which path to choose from it’s routing table based on the preference the route has associated with it. This ‘preference’ refered to as administrative distance(AD) is usually the weight given to the route by default (although it can be manipulated manually) when the route was injected into the routing table by the given routing protocol.

A routing protocol would define the rules a process on the router follows to learn the path to any given destination and then injects this information into the routing table. This can get confusing for the router if it has multiple routes to the same destination injected into its routing table by different protocols. This is where preference comes into play.

Suppose two routing protocols, i.e. RIP and OSPF are running on the same router and both calculate a path to network and try and inject this best path in their opinion into the routing table, the router would see two entries in its routing table for the same destination, i.e. via RIP via OSPF

If the router is a cisco router and provided default administrative distance is used for each routing protocol when injecting the route into the primary routing table(which is the ‘preference’ mechanism explained above), the router would prefer the route learnt via OSPF rather than RIP as it would give the route learnt via RIP an AD of 120 whereas route learnt via OSPF will carry an AD of 110 and the golden rule of thumb here is the lower the AD, the better!

Apart from static routing protocol (which I will get into later), all routing protocols are simply processes on a router than run to gather routes dynamically from neighbouring routers instead of manually configuring routes onto the router. This dynamic route gathering enables easier management and better redundancy protection as neighbouring routers can identify and inform the router about changes in their routing table due to detection of lost routes by their routing protocol. This way a router would know automatically if it needs to discard a route from its routing table.

Suppose an OSPF neighbour informed the routing protocol running on the router in the example above of the loss of route claiming that it has lost access to that network completely, the routing protocol on the receiving router would pull out this route from the routing table and the router would now be left with only one route to network which would be via RIP even though it’s AD is 120, it is the only route the router can find in its routing table. When the neighbouring OSPF router recovers the path and restores it in its OSPF process, it is then re-advertised to the router in our example and it is then re-injected into the routing table overtaking RIP route to once again.

You could however, manipulate the administrative distance manually and prefer RIP routes over OSPF.

Dynamic routing protocols assist in updating the routing table to achieve a dynamically updated routing table which manages itself without the need of tedious manual configuration.

Static routing protocol on the other hand points to a manual static route configured for a destination and has a very low AD (lower AD is better) so it is always preferred by default over dynamic routing protocols but has its limitation including the fact that it will stay up as long as the next-hop to the route is reachable even if the next-hop (which usually is the neighbouring router) has lost its route to the network the static route points to in the first place. This means traffic would still be sent out towards the next-hop pointed in the static route hoping it would reach the intended destination but wouldn’t.

You can configure multiple static routes to the same destination using the qualified next-hop command in junos (operating system that runs on juniper routers) which allows you to prefer one static route over the other. Please refer to the guide to implement qualified next hop in junos here.

The reason static routes are still in use today is because of the quick injection of routes they allow and they can prove to be very handy when you don’t want to fiddle with the way dynamic protocol is already working in your network.

Got questions? Leave a comment! Let’s chat.

Rafay Rasool is a Network Specialist with over 8 years of experience designing, configuring and implementing core network solutions based predominantly but not limited to Juniper Routers, Switches and Firewalls along with other vendors such as Cisco, Huawei, Siemens, Aerohive, Ringmaster, Pulse etc for Internet Service Provider and Enterprise Networks.

Rafay is an avid supporter of network automation and likes to code and automate networking solutions.