How does routing table work?

routing table example,how routing table works, routing table tutorial

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  the gateway  to the packet is 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.


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.



addressing modes types,1,advance-java,2,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,C Programming,12,C Plus Plus,1,C Programming,5,C Programming Questions,1,C programming study material for gate exam,7,Cache Memory,1,CBNST Program,1,Childcare,1,CJ,1,Cloud Computing,1,CN,2,Computer Architecture,2,Computer architecture based questions for gate exam,11,Computer Network,8,Computer Network Study Material,2,Computer network study material for gate,1,Computer Networks,8,Computer networks GATE Questions,1,Computer Science Study Material for Gate,14,computer science study material for gate exam,28,contiguous memory allocation,2,Core Java,3,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,Data Structure,2,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,DBMS,5,dbms question paper,1,DE,1,Digital Electronics,1,DS,4,Dynamic memory allocation in c,1,Electroencephalogram,1,file management in operating system notes,1,Gate 2017,5,Gate 2017 Admit card,1,Gate 2017 Exam Schedule,1,Gate 2017 Syllabus,1,gate cse study material,1,gate practice set,7,gate study material for computer science,12,Gate study material for computer science 2017,1,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,4,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,JDBC,2,JS,1,lagrange's interpolation formula,1,lagrange's interpolation formula examples,1,memory fragmentation,1,memory management,1,memory management questions and answer in os,1,Motivational,4,NCER,1,Numerical Techniques Lab,1,OOT,1,Operating System,10,Operating System Gate Questions,1,Operating System Objective Questions,4,Operating System Questions Bank,1,Operating system questions for gate,1,Operating System Study material,2,operating system study material for gate exam,13,Operating system tutorial,2,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,Pointer in C,4,Process based question for gate,1,Regression testing,1,relocation in memory management,1,relocation registe,1,relocation register,1,resident monitor,1,resident monitor in operating system,1,routing table,1,Software Engineering,10,Software Engineering baes study material for gate,1,Software Quality Assurance,3,software verification methods,1,Stack,1,Structure in C,1,Study Material for gate Computer Science,7,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,TCS Interview Questions,1,Technical Interview,1,Technical Questions from DBMS,1,Thrashing in Operating System,1,Threads concept in operating system,1,Tips to Learn Coding,1,Types of operating system,1,UML,1,What is process control block ?,1,what is software testing?,1,Wireless Sensor Network,3,worst fit algorithm for memory allocation,1,XML,2,
Computer Science Junction: How does routing table work?
How does routing table work?
routing table example,how routing table works, routing table tutorial
Computer Science Junction
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy