- Think Like A Computer - https://www.think-like-a-computer.com -

The Routing Table

Welcome to part 2 in a 3 part series of articles about routers and routing . If you have arrived here directly through a search engine you may wish to read Part 1 – How Does a Router Work? first. Here we are going to look at the routing table.

All network devices that use the TCP/IP protocol have a routing table, even your Windows PC has one. ALL devices use their routing table to determine where to send packets. Without a routing table your PC wouldn’t even be able to communicate with computers on the same subnet. Here is a screenshot of the routing table of my PC. To see your own routing table open a command prompt by typing CMD in the run or search box. Then at the command prompt type “”route print” and press enter.

Routing Table

Routing Table

Here are the TCP/IP settings of my PC:
IP Address:
Subnet mask:
Default gateway:

Before continuing you should know how the subnet mask works to define the start and end range of a subnet. If you do not you need to read computer networking basics now.

Each line is a route to a specific network or device. The routes you can see in the picture are the default routes Windows creates for a PC. Let’s examine my routing table and take a look at each line:

How the Routing Table is Processed

Before sending a packet your PC looks up the destination IP address in the routing table to determine the best route possible. A more specific match will take priority over others. For example if our PC from above wants to send data to it first looks this up in it’s routing table and finds the entry It also finds the entry but as is a closer match it takes priority. If I were to add a static entry (which we’ll come onto later) of with a netmask of this is an EXACT match so this would take priority over the AND entries. Once it finds a match it then checks the gateway column where in the case of our entry it finds the “on-link” status. The on-link status tells the machine that this network is directly attached so it sends the packets directly to using the NIC with interface

If a PC can’t find a matching entry in the routing table it will fail. It will also fail if the routing table is wrongly configured. For example what do you think would happen if we remove all the entries starting with 192.168.111? If I try to connect to any IP address starting with 192.168.111 there won’t be a specific entry for this anymore so the next best route is This route tells my PC to forward the packets to the gateway which would consequently fail of course. The same would happen if I left those entries in but changed the gateway from “on-link” to (a random IP). What I am telling my PC to do now is forward all traffic for the network to instead of going directly to the PC’s. As you can see this would also fail.

You may be wondering what the interface column is for? Well if you remember, routers have two NIC’s. When a router forwards packets it doesn’t know which NIC to use without this value. In the case where there is only one NIC in a device (like a PC) this value would be pointless, but when there are two or more NICs you must tell the router which one to use for a given route.

A Step by Step Routing Example

Let’s expand on the above network and take a look at the router The routing table will be similar to the one above but will obviously have references to it’s own IP address rather than We will join the router to another subnet with it’s second NIC. We assign it an IP address of with a subnet mask of Doing so automatically adds more entries into the routing table. We would now have an additional entry as follows:

destination address, netmask, gateway on-link, interface

From everything learned so far we can now trace the exact steps taken when one computer communicates with another on a different subnet. Now our router is aware of two subnets and it knows that it is directly attached to both of them via it’s respective interfaces. This is what happens when our PC  with IP communicates with a PC on the other subnet (

In summary all devices have a routing table, without it they wouldn’t know where to send packets to. When a PC sends packets to another PC it looks at it’s routing table to determine the best route possible. If it finds the destination address is “on-link” it knows it is part of the same subnet as the destination and sends the packets directly to the PC. If not it forwards the packet onto whatever is in the gateway field of the matching route entry. This same process is repeated at every router/hop along the way until it eventually arrives at a router that is part of the destination network. The router then sends the packets directly to the destination PC. Check out the next article in this series Part 3 – IP Routing.