IP Routing: An overview

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@henrychidiebere·
0.000 HBD
IP Routing: An overview
After going through a hectic job interview in Lagos yesterday, I discovered that there are things you need to know as an IT person. Even though I went for core networking job, many that came for software positions were asked about IP and IP routing, which mandated me to put up this write up as it is something we all need to know and it will definitely come in handy.

![](https://steemitimages.com/DQmbKMrZdJsB7mU67wQPyEvktQC9F5g6X5vbKx7eMahjDTM/image.png)
credit: <a href="https://commons.wikimedia.org/wiki/File:IP-Paket_Routing_%C3%BCber_Netzwerke.svg">wikimedia</a>
IP routing is a term used for finding the best path through our networks by network equipment, usually tweaked by us. When we move to a new neighborhood, we desire the shortest path to our various outings, sometimes we overlook the short path due to some circumstances like bad road, safety, etc. The same thing is applicable to our networks. Routers are network equipment with the job of taking our requests to their various destinations safely and as securely as possible. Every router desires the shortest path through a network but sometimes, these are not always the safest path, hence we influence the choice of routes the router uses to get to packet destinations by tweaking or configuring the router to our taste. Router configurations would be overlooked in this post for the purpose of simplicity.

Networks are broadly divided into two; Internal Network and External network. The internal network is the network within an autonomous system. They could also be regarded as Intranet and these are the network within one's care. External networks are network outside our care and could span as wide as the internet. It could be regarded as the Internet. Within the external network, we have a network of networks. Routers use different rules and algorithms called routing protocols to choose the best path within the network. The routing protocol used in selecting the best path within an internal network is called Interior Gateway Protocol (IGP) while the routing protocols used in selecting the best path outside our network is called External Gateway Protocol. Before I discuss these two classifications of routing protocols, let us get to know the characteristics of a routing protocol.

<h6>Administrative Distance</h6>
<hr>
This is a logical numbering given to routing protocols to represent their level of "believability". The AD is logical in the sense that though it has a default value, it can be tweaked to suit the need of desired design. Administrative distance is usually considered when there is more than one route available. When routes are received by network equipment (router), it selects the route with the least value, hence the smaller the value, the more reliable the route. 

The smallest administrative distance value is 0 which is used for directly connected interfaces on the router. This means the router will believe networks located off of its directly connected interfaces than any other network. Also, the highest administrative distance is 255 meaning the route is not reachable, hence any packet received and destined for a route with an AD of 255 will be dropped since the route is unreachable. When you are not connected to the internet and try pinging internet addresses, your command prompt responds with different auto responses depending on your level of connection.
![](https://steemitimages.com/DQmb8SCxQEzepyWF3mkBCEwfXR92VTxUUGfz9QACiMctbve/image.png)
credit: @henrychidiebere
For instance, from the ping command I executed above, I tried pinging "google.com" and the command failed without even leaving my network stack because the address could not even be resolved but when I pinged 4.2.2.2 it responded with "general failure" which is a Windows hardcoded response since I removed my LAN cable before executing the command. If I was connected to a router that has no connection to the internet, that destination IP (4.2.2.2) would be given an AD of 255 and an <a href="https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol">internet control message protocol</a> (ICMP) would be used to inform my pc that the route is unreachable and I would get a response of "destination unreachable" instead of the response I received above.

<h6>Routing table</h6>
<hr>
Routing tables are lists of known routes to the routing protocols. This is a very distinguishing attribute for routing protocols since every protocol arranges routes or paths known to them differently. A routing table can get as little as the interfaces (ports) on the router or as big as the paths available on the internet! the image shown below is the output from my internet facing router showing the routes it learned from different routing protocols. The protocols are abbreviated and the key to the abbreviation is shown in the image. 

![](https://steemitimages.com/DQmVNmULrEErRePtxhFwaS4CDiHuEabKPj4wQqHAxYeKG4a/image.png)
credit: @henrychidiebere
The addresses with the letter B preceeding it was learned from a routing protocol used in the internet called Border Gateway Protocol (BGP) and many other protocols which I will explain shortly.

<h6>Autonomous System</h6>
<hr>
Many would say that an autonomous system is a unit of a router's policy but in a simpler term, an autonomous system is a network within the jurisdiction of an engineer. All the network within my control is regarded as an autonomous system and hence I can use any routing protocol of my choice within my autonomous system. Some routing protocols are used to route between autonomous systems like the BGP.

![](https://steemitimages.com/DQmfD9py92v6yrYzGgPeDJT8NMZrESfJvgkZtD8tPbBWzLQ/image.png)
credit: @henrychidiebere
The routing table shown under the routing table subheading was taken from the router circled in the image above. The whole network belonging to your internet service provider (e.g MTN) can be regarded as an autonomous system, hence the internet is a connection of autonomous systems.

<h6>Interior Gateway Protocol (IGP)</h6>
<hr>
Interior gateway protocols are protocols used in exchanging information about paths within a network usually between routers that are found in the same autonomous system. When information about paths within a network has been received, the router then runs a certain algorithm which is then used to route layer three based protocols like the Internet Protocol. IGP is also further divided into Link-state and Distance-vector routing protocols.

<br>
These classifications are based on how the best path is selected by the network equipment. The distance vector routing protocol chooses the best path based on the distance of routes (paths) usually measured by the number of equipment required to reach a particular destination. A very good example of distance-vector routing protocol is the Routing Information Protocol (RIP). The Link-state routing protocol chooses the best path through a network by creating a map of the whole network within an autonomous system, though this might sound very good though it uses a huge amount of resources from the equipment it was implemented on to carry out such activities. Example of link-state routing protocols includes Open Shortest Path First (OSPF) and Intermediate System to Intermediate System (IS-IS).

<h6>Routing Information Protocol</h6>
<hr>
As stated above, the RIP is a distance vector routing protocol and also a legacy routing protocol. Also as stated above, it uses a measure of distance to determine the best path through a network. It efficiently calculates the distance to a destination by counting the number of routers required to reach a destination (hop count). If a router that is running this routing protocol receives a packet with destination greater than 15 hops away, that packet is discarded since the maximum hops allowed within an autonomous system is 15. This is done to prevent loops in the network as loops can bring a network to its knees. 

![Capture.JPG](https://steemitimages.com/DQmXfsexfC2zpQHZajnNqgUj7XtfkzXPB1CwK2yXfx7P2kb/Capture.JPG)
credit: @henrychidiebere
To understand the effect of loops in a network, consider the image shown above, router A sees router C as being one hop away from itself while router B sees router C as being zero hops away. When Router C goes down and router A wants to access networks off of router C's port, router B tells router A that it is zero hops away from itself then router A concludes that since router C is zero hops away, then the network must be 1 hop away from itself. Router C then updates itself using this information, that since router C is one hop away from router A, then router C must be 2 hops away from itself. Router A then updates itself further using this information hence, placing router C as being 3 hops away. If loops are allowed to occur, this process can proceed to infinity!

In order to prevent such scenario, once a route goes down, the router facing such route automatically advertises such routes as having a hop count of 15 which is the same as saying such routes does not exist anymore on the network. To further make this process efficient, the router is made to never advertise a route in learned from an interface back to that same interface (split horizon). Hence in a situation such as the one above, router B does not believe routing information about router C from router A since it was the router that initially advertised networks available off of router C's interfaces.

RIP has an Administrative Distance of 120 by default. The RIP has versions one and two with the version two serving as an extension of version one with the capability of forwarding packets with a more accuracy. RIP has the advantage of being very easy to setup and uses the least amount of resources from network equipment when compared to the rest of the routing protocols.

<h6>Open Shortest Path First (OSPF)</h6>
<hr>
OSPF is the most widely used link state routing protocol since the Intermediate System to Intermediate System (IS-IS) is almost obsolete. OSPF finds the best path through a network by creating a map of the network using the <a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra's algorithm</a>. For this very map to be created in the network, routers running this protocol shares information about the network available in their database. Routers that can share information within a network are called <i>neighbors</i> and the information exchanged are saved and displayed in a table called <a href="https://webhelp.radware.com/AppDirector/v214/OSPF_Neighbor_Table.htm">neighbor table</a>. 

<br>
<div class="pull-left"><center><img src="https://steemitimages.com/0x0/![areas.png](https://steemitimages.com/DQmTLjz62hva1rBJZyTfsexh5g2Ex8GWmEqkGx5pET9nD5p/areas.png))" /><br /><em><a href="https://commons.wikimedia.org/wiki/File:OSPF_Network.svg" rel="noopener">credit: wikimedia</a></em></center></div> Since OSPF creates map of networks within an autonomous system, this process takes lots of resource from the equipment hence to reduce this, network administrators are advised to break their networks into <a href="https://www.juniper.net/documentation/en_US/junos/topics/concept/ospf-routing-understanding-ospf-areas-overview.html">areas</a>. 

These areas exist in hierarchy and are numbered from zero (0) to as much as 4294967295! The area 0 is considered the master area and all the areas are required to make contact or connection with area 0.
The rest of the areas can be considered as ;
<li>Stubby area</li>
<li>Not So Stubby area</li>
<li>Totally Stubby area</li>
<li>Not so Stubby area and</li>
<li>Totally Not So Stubby area</li>
Areas which does not have connection to area 1 can be linked to area1 using virtual link as shown in the image to the left above.

<h6>Enhanced Interior Gateway Protocol (EIGRP)</h6>
<hr>
The enhanced interior gateway protocol is Cisco proprietary routing protocol which spots the features of both the link state and the distance vector routing protocol hence, it is considered by Cisco as a hybrid routing protocol though it is considered in the industry as a distance vector. The OSPF is a very robust routing protocol and can be tweaked to meet most business needs. <div class="pull-left"><center><img src="https://steemitimages.com/0x0/![DQma3armvQK8oeecfm5jYJGgA1WZss2LrXV3c7NXsPfCLb5.png](https://steemitimages.com/DQmQ6kd1KZkAEwRBBTGZLMP2Y1V6WpANgDi8KtwWqCyExP9/DQma3armvQK8oeecfm5jYJGgA1WZss2LrXV3c7NXsPfCLb5.png))" /><br /><em><a href="https://commons.wikimedia.org/wiki/File:EIGRP_Algorithm_-_en.png" rel="noopener">credit: wikimedia</a></em></center></div>Though it has one major drawback, it can be very complex to setup and troubleshoot. 

<br>
EIGRP can be as simple as RIP which the setup involves only stating the interfaces/ports that should be involved in the routing process or as complex as OSPF in which the setup not only involves adding interfaces to the routing processes but also stating which routes to accept and which routes to reject.

EIGRP uses Diffusing Update Algorithm Finite State Machine (<a href="https://en.wikipedia.org/wiki/Diffusing_update_algorithm">DUAL FSM</a>) for calculating the best loop-free path through autonomous systems. It also maintains tables containing paths (routes) it learns from other equipment (neighbors) within an autonomous system. By default, the administrative distance of EIGRP is 90 which means paths learned by EIGRP would be believed instead of routes learned through OSPF process which has administrative distance of 110.

<br>
<h6>Border Gateway Protocol (BGP)</h6>
<hr>
The rest of the routing protocols discussed above are used for routing within an autonomous system. Though sharing route information can be done between interior gateway protocols using special means called <a href="https://www.cisco.com/c/en/us/support/docs/ip/enhanced-interior-gateway-routing-protocol-eigrp/8606-redist.html"><i>route redistribution</i></a>, this is still within an autonomous system. The BGP is the routing protocol of the internet though this can be used within an autonomous system in the form of iBGP though this would be the routing protocol of the last resort since it has an administrative distance of 200. 

<center>![](https://steemitimages.com/DQmbRHLzqrEtP3irEF49An7V6kFBa7uYbCz43zVzHR27rm6/image.png)</center>
<center>credit: <a href="https://commons.wikimedia.org/wiki/File:AS-BGP.png">wikimedia</a></center>
The BGP (External or internet routing protocol) has an administrative distance of 20 which makes routes learned from the Internet Service Providers (ISP) is always given more priority than most protocols.

Classification of BGP has never been a very straight one since some network engineers consider it as a distance vector while some consider it a <a href="https://en.wikipedia.org/wiki/Path_vector_routing_protocol">Path vector</a> routing protocol. As already stated above, distance vector routing protocols make decisions based on the number of routers required to reach a destination whereas BGP makes the decision on the best path to a packet's destination by considering the number of an autonomous system required to reach a packet's destination (autonomous system hops).

As shown in the image above, BGP connects different internal routing protocols like the OSPF, internal border gateway protocol (iBGP), EIGRP, etc., though it performs its convergence (<i>convergence is a state of routing protocol whereby it has learned every route known by its neighbors, carried out calculations based on inbuilt algorithm and ready to route packets</i>) calculations more slowly than the rest of the routing protocols discussed above this is because changes are made to networks on the internet very often hence these changes are made unnoticeable and resource impact on networking equipment minimal by making convergence of BGP very slow.



<hr>
<h3>Reference</h3>

1. <a href="https://www.juniper.net/documentation/en_US/junos/topics/concept/ospf-routing-understanding-ospf-areas-overview.html">Understanding ospf areas -Juniper</a>
2. <a href="https://en.wikipedia.org/wiki/Diffusing_update_algorithm">Diffusing update algorithm -wikipedia</a>
3. <a href="https://www.cisco.com/c/en/us/support/docs/ip/open-shortest-path-first-ospf/13703-8.html">Open shortest path first -cisco</a>
4. <a href="https://www.metaswitch.com/knowledge-center/reference/what-is-ip-routing">what is IP routing -metaswitch</a>
5. <a href="https://en.wikipedia.org/wiki/Border_Gateway_Protocol">BGP -wikipedia</a>


<hr/>
<hr/>
<sup>
If you write STEM (Science, Technology, Engineering, and Mathematics) related posts, consider joining #steemSTEM on steemit chat or discord here. If you are from Nigeria, you may want to include the #stemng tag in your post. You can visit this blog by @stemng for more details. You can also check this blog post by @steemstem here and this guidelines here for help on how to be a member of @steemstem.</sup>

<center>![DQmeqXkd5iiKxkeTXDhAX3MW7V8bL59TF28pTtf57toNvDz.gif](https://steemitimages.com/DQmeqXkd5iiKxkeTXDhAX3MW7V8bL59TF28pTtf57toNvDz/DQmeqXkd5iiKxkeTXDhAX3MW7V8bL59TF28pTtf57toNvDz.gif)</center>

<img src="https://steemitimages.com/0x0/https://steemitimages.com/DQmRhDtjokAZnGKi4QwheqksKTFo6m4fsjMYsNNrsitC1xk/DQmRhDtjokAZnGKi4QwheqksKTFo6m4fsjMYsNNrsitC1xk.gif" alt="DQmRhDtjokAZnGKi4QwheqksKTFo6m4fsjMYsNNrsitC1xk.gif" />
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,