Routing Table: What is it, and How to Configure it

The word router is one of the most commonly read or heard when we talk about networks. However, it never hurts to know a little more about how they work internally. This time, we are going to talk about routing tables . This is one of the essential components for a router to fulfill its function, and that consists of directing the data packets to the destination through the most appropriate route.

A routing table is a set of rules used to determine which path data packets should follow. All this through any network that works with the IP protocol. Any device that has the possibility of having an IP address, including routers and PCs like Windows, Linux or Mac, have a routing table to know how to get to the destination.

Routing Table: What is it,  and How to Configure it

Components of a routing table

Such a table contains all the information necessary to enable one or more data packets to travel across the network using the best path. Thus, its arrival at the destination is guaranteed, as long as connection-oriented transport layer protocols are used, such as TCP, since TCP does guarantee that a packet reaches the destination correctly.

It is good to remember that each data packet contains, whatever the redundancy, additional data that helps us to know regarding the source IP address and the destination IP , among other information that goes in the header.

As an example, let’s mention a router, these types of devices have one (or several) routing tables. What said table does is allow said device to send the data packet to the next hop, that is, to the next network interface it may encounter. However, this depends solely on the way we have configured our networking devices. In this case, the routers.

The components of a routing table are:

  • Destination network: this corresponds to the destination network where the data packet should go.
  • Subnet mask: it is the one used to define the subnet mask of the network to which we must go.
  • Next hop: in English this is known as next hop . It is the IP address of the network interface where the data packet will travel, to continue on its way to the end.
  • Outgoing interface: it is the network interface through which the packets must leave, to later finally reach the destination.
  • Metrics: they have several applications. One of them is to indicate the minimum number of jumps to the destination network, or simply the “cost” to get to the destination network, and it is used to give priority.

The types of routes that can be stored in a routing table are:

  • Directly connected
  • Remote routes
  • Host
  • Default routes
  • Destiny

It is extremely important to have reinforced the concept of routing. That is, what is the function of a router on the network:

  1. Receive the data packet.
  2. Find out what the destination address is.
  3. Verify the routing table you have configured.
  4. Proceed to send the package to the destination by the best possible route.

How do I maintain a routing table?

Basically, in three ways: Directly connected networks are maintained automatically, since they are directly connected and routes are added automatically. We also have static routing , where the network administrator adds or removes one or more routes, and finally we have dynamic routing .

Today, a lot of importance is given to dynamic routing. How does it work? Network devices, in this case routers, create and update their routing tables automatically. They do this through routing protocols to exchange information regarding network topologies.

If you have a large or very large network, static routing and, consequently, manual maintenance of it, will involve many hours of effort by technical personnel. The latter is very impractical and much less productive. Dynamic routing tables allow connected network devices to “listen” to each other, so that they can automatically update their routing tables according to network events. Especially if we are talking about network failures or congestion.

Next, we’ll take a closer look at both static and dynamic routing.

Static routing

As we have commented, the static routes are configured in the router manually, the same thing that happens with its maintenance. At what point could a request be made to change? When there are changes in the network topology. Although static routing is generally very laborious, especially when performing maintenance, it has a couple of benefits that still make it an option to configure routing:

  • Greater security that a route has been entered correctly and there are no problems, since they are entered manually by the administrator.
  • Efficiency when managing resources, because there is no protocol working on the router.

There are two main types of static routing: to a specific network and default static (or default route) . For a better context, if IPv4 is used, the configuration of static routing to a specific network has the following structure:

DirecciónIP MáscaradeSubred IPsiguientesalto | InterfazDeSalida

Let’s apply this structure to a router command from the Cisco manufacturer:

ip route 192.168.0.0 255.255.255.0 192.168.10.5

Instead of the IP of the next hop, that is, the IP of the interface through which the data packet will continue to navigate, we can indicate the interface:

ip route 192.168.0.0 255.255.255.0 serial 0/0/1

Now, on the side of the default static route or default route, we must know that this works when the routing table does not have a specific route for the destination network. This especially applies when you have to configure routers that allow the Internet.

Why would the route to a specific network not be useful if we are going to surf the Internet? Because no one is sure what kind of web sites and services you will be accessing every day. We do not perceive it, but we as users of the network of networks, we are accessing multiple networks on a daily basis.

So the specific static route is not feasible, nor the dynamic one because the home routers would not support all the networks in the world. Hence, the default route will allow us to go where we want, when we need Internet access, since it will send all the default packets to the operator’s router.

However, the structure of the configuration command is very similar to the “normal” static route. Let’s see its structure:

0.0.0.0 0.0.0.0 IPsiguientesalto | InterfazDeSalida

Let’s apply this structure again to a Cisco router command:

ip route 0.0.0.0 0.0.0.0 192.168.10.5

Instead of the IP of the next hop, that is, the IP of the interface through which the data packet will continue to navigate, we can indicate the interface:

ip route 0.0.0.0 0.0.0.0 serial 0/0/1

Dynamic routing

The routers use the different dynamic routing protocols to share all data related to the state of the networks . Rather than having a network administrator manually configure routing tables, dynamic routing protocols take care of this. The only thing that the administrator will have to do is correctly configure the dynamic routing protocol, and share the networks that are directly connected, so that other routers know where they should go in case access to that network is required. This kind of learning allows the best route to be determined for each case and then adds it to the router’s routing table.

It is important to mention a couple of advantages related to dynamic routing. The most important has to do with the ability to determine a new better route if the one that was originally determined has been taken out of operation. On the other hand, human intervention is not necessary in any case, not even with the most complex network topology changes. Depending on the scenario, we will have to use Interior Gateway Routing Protocols (IGP), which are used within an AS (Autonomous System), such as RIP, OSPF, IS-IS or EIGRP. Also, if we are going to intercommunicate different AS, the protocol used is BGP.