# Trying to understand a Router's Forwarding Table

I am trying to understand how a router's forward table works. As such, I am working on the following problem.

Problem:
A router’s forwarding table has the following entries. $$\begin{array} {|r|r|}\hline Network \, Number & Next \, Hop \\ \hline 0.0.0.0/0 & 15.15.1.2 \\ \hline 192.140.20.0/24 & 15.15.1.8 \\ \hline 192.140.20.0/20 & 15.15.1.9 \\ \hline \end{array}$$

Now, if the router is given an IP address like $$192.140.20.3$$ which row of the table would be used?

Here is how I see it. The first row of the table is not a match. It is going to match either the second or third row. The addresses given in the two rows are the same expect for the qualification. That is, the first address has a subnet mask of $$24$$ bits. The second one has a subnet mask of 20 bits. We do not know how big the subnet mask of the IP Address given is. So, I do not know what the router will do.

In the forwarding table given there is no metric field. If there was, in this case, it would be used to select either row 2 or row 3. Am I right about this?

• 1. 0.0.0.0/0 matches anything. It's the default route. 2. Addresses don't have subnet masks. An address is an address. Thus the address you're given matches all three lines. But one of them is the most specific.
– rici
Sep 27 at 2:14
• @rici What you are telling me is that the router will select either row 1 or row 2. Is that right?
– Bob
Sep 27 at 11:54
• Line 2 is more specific, so I'd expect it to apply. If it didn't, the line would be useless, and routers don't like to store useless data.
– rici
Sep 27 at 13:45