IP ROUTING

in #steemstem6 years ago (edited)

When we pack into a new neighborhood, the first thing we notice is the challenges we face in getting to various places like the market, school, workplace, etc. Sometimes we tend adopt the major roads to our various outings as they are the surest way to get to these destinations and in so doing, we tend to waste more resources on transportation and also spend more time on transit. As we get to know our neighborhood better, we start to discover “shortcuts” to our various destinations which results in positive changes like reduced transportation costs and spending shorter time on transit.


[credit: Pixaby. CC0 license. Author: Jeferrb]

The above paragraph described a typical traffic as it concerns human movement, but the same is applicable to internet traffic. When we build a new network or when a network that was initially in the down state comes up, it first runs a preselected algorithm and with the help of certain protocols (which I will describe in this blog), it gets to know its surroundings and with time, it makes the best choice in terms of routes to any destination initiated by a user.

What then is IP routing?

A network is simply a connectivity between two or more computers while an internetwork is the connectivity between two or more networks. A computer in a network is regarded as a network host and is well equipped to find its way “within” its own network but problem arises when a host (a server, laptop, phone, etc.) makes a request with destination outside its own network. A host is designed to push such request to another set of equipment called a gateway (example are routers, firewalls, etc.). Every network that is connected to the internet has a gateway and as the name implies, a gateway is an ingress or egress point of a network. Any traffic entering or leaving a network must do so through the gateway.

IP routing is the process of choosing the “best” path for a packet through a network by making use of standard policies and rules called routing protocols. The “best” is in quote because it is relative which means that what is the best for this protocol might not be best for another protocol, also what is the best path for one network administrator might not be the best for another administrator. The process of IP routing is broadly divided into two:

  • Static IP routing and
  • Dynamic IP routing
  • Much time would be spent on the dynamic IP routing since static routing is only of one type and is straightforward. To facilitate maximum understanding of the topic being discussed, I would explain some concepts and terms involved in IP routing before going on to expand on the two methods of IP routing.

    Administrative Distance (AD)



    [credit:Wikimedia CC4.0 license. Author: Farmartin]

    When we newly enter a city, it is very normal to not know all the routes to our destinations. In such situation, it is also very normal especially in the society I find myself to inquire about a route to your destination or a route to where you could easily navigate yourself to your final destination.

    When I find myself in such condition, I always make inquiry from the commercial motorists or commercial cyclists and if initially I could not inquire from a commercial motorist, I got a route from a passerby and also later got a route from a motorist or cyclist, I would believe the route given to me by the commercial motorist due to security reasons and also, they would know their way around the city better than a passerby.

    This same concept is applicable in the field of IP routing. Administrative distance is an arbitrary number given to routing protocols to show their level of “believability”. The number ranges from zero (0) to two hundred and fifty five (255) with zero being the most trusted route and a route with AD of 255 is regarded as an unknown destination. It is of importance to state here that gateways only consider the administrative distance when it receives more than one information about a particular route though this is a frequent situation in IP routing. The popular default administrative distances for routing protocols are shown below.

    Routing protocolsDefault AD
    Directly connected routes0
    Static route1
    Border Gateway Protocol (BGP)20
    Enhanced interior gateway routing protocol (EIGRP)90
    Open shortest path first (OSPF)110
    Routing Information Protocol (RIP)120

    From the above table, it can be seen that when a gateway learns about a destination from two routing protocols say, OSPF and EIGRP, the route it learned from the EIGRP would be promoted to the routing table which would be used for its navigation, hence lets get to know the routing table, we will get to know the routing protocols soon.

    Routing Table


    [interpreting a RIP route entry in the routing table. Credit Wikimedia CC4.0 license. Author: Narangarav0417]

    A routing table to the network administrator is seen as a table of values but in the real sense, it is a table showing set of rules observed while navigating through the network. It instructs the gateway on the exit interface to queue packets it receives. With respect to the selected routing protocol, only the best route makes it to the routing table. Some routing protocols keeps another table similar to the routing table where they store the next best route to the best route, these routes are quickly promoted to the routing table if the best route suddenly goes down or is unavailable.

    A routing table contains many vital information about all the routes know to the gateway (router), these information include the destination IP address of a route, the interface where such route was learned from, the routes administrative distance, the next hop address which indicates a route that leads to a known destination, the metric of a route which is a value given to a route to indicate how far, how easy and the amount of traffic a route can accommodate, and finally all the directly connected interface of the gateway.

    Static IP Routing


    If you understand what I've been saying so far, then you're very close to being a network administrator! No production network is void of static route. A static route as the name implies is a route pointing to a known destination and cannot change on its own. When a network administrator knows every part of his network, defining static route is very easy and has the advantage of being the fastest routing protocol since the gateway don't need to run any algorithm before forwarding any packet.


    [default static routes are usually used at the gateway (edge router) to direct all unknown traffic. Credit: Wikimedia. CC4.0 license. Author: Luca Ghio]

    A very popular static route is the default route. It is impossible to define all the networks within the internet, hence the need for default route. A default route is a static route used by both dynamic routing protocol and static routing protocol for pointing every unknown address and traffic to a destination (usually the internet service provider). The default route usually points to the ISP as it is assumed our ISP knows all the routes in the internet which is due to the type of routing protocol used within their network (Border gateway protocol).

    In defining a static route, the gateway is provided with information like the desitnation IP address, destination subnet mask, the destination exit interface, etc., consider the static IP routing statement below

    Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1 123

    This is a default static routing with destination IP address of 0.0.0.0 which means any unknown IP address, destination subnet mask of 0.0.0.0 which matches any unspecified subnet mask of an IP address, the IP address 192.168.1.1 which is the address where all these unknown addresses and unknown traffic would be directed to (this is usually the ISP address) and finally the number 123 which is the believability of this route or its administrative distance. The administrative distance is optional and in case where it is not provided, the number "1" would be automatically substituted by the gateway.

    The highest downside of the static routing is that it does not change when a change occurs within the network, hence, the static routing protocol requires high administrative overhead. Another issue associated with static routes is misconfiguration of addresses and interfaces. It is very common for an administrator to enter the wrong IP address while running a configuration and this would lead to spending much time troubleshooting a given network.

    Dynamic IP routing



    [A dynamic protocol automatically redirects traffic if a known link goes down. Credit: Wikimedia CC3.0 license. Author: BP63Vincent]

    The dynamic routing protocol makes use of rules and policies in the form of protocols to direct gateways (router) on the best path. The major advantage of dynamic routing protocol just like the name implies is that it is dynamic, that is, it changes as the network changes. It automatically reflects changes made to the network. Every network is broadly divided into internal and external network so also is the dynamic routing protocol.

    The internal dynamic routing protocol is used to dynamically learn and populate the routing table of a gateway or router from routes within an administrative privilege. Any network outside an administrator's jurisdiction is considered external to him and can run external dynamic routing protocol within such environment.

    Internal dynamic routing protocol

    As already stated, an internal network is a network under privilege of an administrator or set of administrators. Routing protocols used under such condition is regarded as internal routing protocol and these are:

  • Link state routing protocol and
  • Distance vector routing protocol
  • Distance vector routing protocol

    Distance vector routing protocol is also called routing by rumor, this is because routing information is obtained by a router from neighboring routers without confirming the validity of such routes. Distance vector routing protocols determines the best path through a network by considering the number of router packets need to pass through before getting to a destination. This is called hop count. Gateways running the distance vector routing protocols periodically exchange information about the routes known to them in a routing packet called hello packet. Only the routers running this type of protocol receive such information because the hello packet is broadcasted to a multicast address (224.0.0.6/5) and the rest are made to only listen to this very address.

    Since this routing protocol does not question the authenticity of received information, problem usually arises when a known destination goes down.


    [designed by me using Cisco packet tracer]

    for instance, consider the image shown to the right, router C knows about router A through router B, hence router C records in its routing table that router A is just one router (one hop) away from itself and to get to router A, it has to use router B. If by any circumstance router A goes down, router B looses connectivity to router A and hence queries its neighbor (router C) about router A. Router C checks its routing table and responds to router B request saying that it knows about router A and it is one hop away from itself.

    Router B then changes its route information about router A saying that it is two hops away from itself and to get to router A, it needs to go through router C. Router B will also discover that it cannot reach router A and queries router B about router C. Router C checks its routing table and returns router B's request saying that router A is two hops away from itself. Router B changes the entry to router A in its routing table and replace it saying that router A is three hops away from itself and to get to router A, it needs to go through router B!

    This is called routing loop and can continue like this forever moreover, the link in question was down long time ago. Two methods are used in combating this routing loop problem, these are:

  • Route poisoning and
  • Split horizon
  • In distance vector routing, routes with a hop count of 16 is considered unreachable. The route poisoning is a process of combating routing loop by automatically assigning a hop count of 16 to any link to goes down. In the scenario above, the moment router B looses connectivity with router A, it assigns that route a metric of 16 hop counts. Once it advertises the route to router A with such metric, router B automatically flushes it out of its routing table because it is considered unreachable.

    The principle of split horizon is a very simple one and is also used in combating routing loops. The principle of split horizon says, don't give me information about a route I advertise to you. This makes information about a route to be one way hence canceling the possibility of routing loops. considering the scenario above, router B informed router C about router A, hence when router A went down, router B will not believe any information it receives about router A from router C since it was the one that advertised router A to router C.

    Their are two distance vector routing protocols in use in the internal networks today, these are:

  • Routing Information Protocol (RIP) and
  • Enhanced Interior Gateway Routing Protocol (EIGRP)
  • EIGRP was introduced by CISCO and was later released as an industry standard routing protocol. Cisco argued that it is not a pure distance vector routing protocol since it uses more than hop count as a metric. Hence, you would see some sites considering the EIGRP as hybrid routing protocol.

    Link state routing protocol

    The link state routing protocol is more complex in operation compared to the distance vector routing protocol. This is because each router in a network build up a graph or map of the network area it finds itself. Hence all the nodes in the network belongs to an area and each router in an area has a map of the whole network and independently runs an algorithm that enables it choose the best route to any destination desired by any node connected to it.


    [OSPF which is a linkstate routing protocol maintains a hierarchical topology and each router in an area runs separate algorithm to determine the best path out of its area. Source: Wikimedia. CC4.0 license. Author: Luca Ghio]

    When a node configured with a link state routing protocol comes up, it first tests the reachability of other devices connected to it. Once any device is reachable and is capable of running the same protocol with it, it goes ahead and tries to form a neighbor with it. Upon successful neighbor formation, it also goes ahead and forms an adjacency with its neighbors. Once an adjacency is formed, then, it shares information about any other device(s) it has successfully formed adjacency with. Instead of routing by rumor, it advertises its neighbors to other neighbors that needs such information.

    Unlike the distance vector routing protocol that advertises its neighbor information periodically, link state routing protocol only advertises its routing information when a change occurs in its area. The major downside to this form of routing protocol is that it takes up much resources to run its algorithm, hence not suitable for devices that have small processing power. Popular link state routing protocols include:

  • Open Shortest Path First (OSPF) and
  • Intermediate System to Intermediate System (IS-IS)
  • External Dynamic Routing Protocol

    The external routing protocol is the protocol of the internet and also regarded as the exterior gateway protocol (EGP). The only available exterior gateway protocol is the Border Gateway Protocol (BGP). BGP is considered a path vector which is very similar to the distance vector the only difference is that whereas distance vector uses hops as its metric, BGP uses autonomous system as its metric. A network within the control of an administrator is regarded as an autonomous system.


    [operations of the exterior gateway protocol. Source: Wikimedia. CC3.0, 2.5 and 2.0 license. Author: Mro]

    Consider the image shown above which consists of four different networks represented using autonomous system number (AS), AS65050, AS65100, AS100 and AS200. The first two autonomous systems are each running interior gateway protocols like the iBGP, RIP, OSPF, etc., these protocols cannot be used within the internet or between a client and his service provider. It can be seen that two instances of the BGP is running the first one being between AS65050 and AS65100 forming another autonomous system AS100. Another instance of BGP is running between the AS100 and AS200.

    The concept of BGP might be difficult to grab but as a summary, it is the only routing protocol used in the internet. It can also be used within a network but it has the ability to crash low powered equipment since it holds all the routes known to the internet.

    REFERENCES


    1. IP routing -Wikipedia
    2. Administrative distance-study-ccna
    3. Distance vector routing protocol -wikipedia
    4. Distance vector routing protocol -geeksforgeeks
    5. Link state routing protocol -cnp3book
    6. Path vector routing protocol -Wikipedia


    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. Please also check this blog post from @steemstem on proper use of images devoid of copyright issues here.

    Sort:  

    You brought the knowledge down to a layman's idea, thanks @henrychidiebere for your post full of knowledge.

    Finally I got the idea of routing. thanks @henrychidiebere keep it up

    Sir its an outstanding job you have done its really a message steemian should be thankful to you for this wonderfull efforts

    Interesting! This very subject although being quite technical especially to newbies in this field was very well explained...all thanks to you! Thanks for a thorough breakdown of this very subject. Great job!

    Coin Marketplace

    STEEM 0.17
    TRX 0.13
    JST 0.027
    BTC 58805.73
    ETH 2642.82
    USDT 1.00
    SBD 2.45