How does routing table work ?

What is routing table in networking ?

What are metrics of a routing table ?

Example of router table.

 
This router table tutorial covers the basics concepts of routing table in networking. In this tutorial I have explained the concepts of routing table with an example and how does routing table work it is also explained. Difference error message occurred during routing are also explained in this tutorial.
 
Before explaining the routing table I would like to recall the previous post.In our previous post  of routing table tutorial which was named as  Routing Concepts in Computer Networks we have explained the basic introduction of the routing concept.
In the continuation of that post now in this article of Computer Science Study Material for Gate, we are going to tell about how does routing table work. In this article provides the information about the different fields of a routing table with a suitable example, what is the use of these fields and how a particular route is selected for the destination host. So let’s start with the introduction of routing table.

What is Routing Table?

Routers maintain a routing table to decide how route the IP packet. The routing is done by Internet protocol when it searches for routing table based on the routing policy and routing mechanism. Routing policy is nothing but it is a set of rules for the selection of the route which will be entered into the routing table.
The term routing mechanism refers to the decision which interface to send the packet out. Generally, Internet protocol performs the routing mechanism while a routing daemon normally provides the routing policy. When a packet needs to be routed to an IP address then following steps should be performed.
1       Search the routing table for an entry that matches the complete destination IP address. If found this entry is selected. Otherwise, it searches the routing table for the entry that matches just the network id. All the host on the destination address just handled by this single routing table entry.IP routing also supports a default entry if the packet does not match any entry then it is routing according to the default entry.
 
routing table in networking

     Routing table example in networking

A  routing table example is as shown in figure.
This example gives an idea of typical host routing table. If we execute the command netstat on the host srv4 with –r option to list the routing table and then –n option to print the IP addresses in place of name then we get the following output.
routing table based study material for gate computer science exam
                                                            Figure 1: Example of Routing Table
 The first line as shown in above routing table says for the destinataion 140.252.13.65  the gateway  to the packet is 140.252.13.35. There are five different flags that can be printed for a given route.
                          U: route is UP
                          G: The route is gateway if this falg is not set  The destination is directly connected.                                   Thus the G flag differentiate between direct and indirect riute.
                         H: route is the host if this is not set then the route is to the network.
                         D: The route was created by  redirect.
                         M: The route was modified by redirect.
                         The reference column gives the number of active uses for a given route.
                      The Connection oriented protocol like TCP holds on to a route  while the connection is                       established.  If we establish a TELNEt connection between two host then we would see                         the reference go to 1.
                     The column use display the number of packets sent thorug the route.
The second line of the output is the entry for the default route. This entry says send the packet to the routers  if more specific route can not be found.
The final line of the output is for the attached network. H flag is not set indicating that destination address is the network address with host portion set to 0.
  • The complexity of the host’s  routing table depends on the topology of the network.
  • The simplest case is a host not connected to any network.In this case routing table consist the entry  for the loop back interface.
  • Next possibility is that a host connected to a single LAN. In this case routing table consist two entry one for the loopback interface and one for the LAN.
  • There may possible that other networks are reachable through a single router. This is handled by the default entry point to that router.
  • A final case may be when the other host specific and network specific router are added.

Different Error Messages Occurred during Routing

ICMP Host or Network Unreachable Error
ICMP host or network unreachable error: normally search for a routing table find a match or the default route. If there is no default route or match is not found for the destination then a host unreachable or network unreachable error is found.
If the datagram is originated from the host then an error message is communicated to the host.  If the datagram is being forwarded to the current host then the error is communicated to the original sender.
ICMP Redirect Error
The ICMP redirect error is sent by a router to the sender of IP Datagram when the datagram should have been sent to a different router.
Here I am going to explain the ICMP Redirect error with the help of the following diagram as shown in the following figure.
routing table in computer networks
    Figure 2: Example of ICMP redirect
1. Assume that the host sends an IP datagram to R1. This routing decision is made because R1 is the default router for the Host.
2. R1 receives the datagram and perform a lookup in this routing table and determine that R2 is the correct next hop router to the IP datagram to.
When it sends the datagram to R2, r1 detects that  it is sending it out to the same interface on which datagram arrived.
3. R1 sends an ICMP redirect to the host telling it to sends the future datagrams for that destination to R2 instead of R1.
A common use of redirect is to let a host with a minimal routing knowledge build up a better routing table over the time.

How the routing table is kept current and update

The capability of sending traffic from one end of the network to the depends on how accurate and correct the current routing table in every router is within the network.
The more recent routing protocols are most efficient so their networks scale more easily.
For example, RIP will send out the entire routing table after every 30 seconds. While OSPF updates contains only the change and are sent only when that change occurs.
OSPF sends entire routing table every 30 minutes after the last update but this is far less demanding the network resources as compare to RIP routing protocol.
The accuracy of a routing table is affected by how quickly it respond to the changes in the network.
These changes include :
  • Learning new networks
  • Learning to a better path to an existing network.
  • Learning that network is no longer available.
  • Learning an alternative route to a network.
  • How each of these change is achieved depends on the routing protocol.

Conclusion

I hope this routing table tutorial will be beneficial for the computer science student and the GATE aspirants to understand them that how does routing table work?
If you like this article then comment and connect with us by following on social media platform Facebook, twitter and google plus ( icon as shown on the right top corner) for more informative article.

Leave a Reply

Your email address will not be published. Required fields are marked *

x