Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

route -n gives:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0   U     0      0        0 eth0

ifconfig gives:

eth0  Link encap:Ethernet  HWaddr 00:0c:29:f1:76:32
      inet addr:  Bcast:  Mask:
      inet6 addr: fe80::20c:29ff:fef1:7632/64 Scope:Link
      RX packets:6387084 errors:0 dropped:24 overruns:0 frame:0
      TX packets:374481 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:712509342 (712.5 MB)  TX bytes:37312703 (37.3 MB)
      Interrupt:18 Base address:0x2024

Why do I need 2 routes here instead of 1? What is the point of this line?   U     0      0        0 eth0

My interface address is 192.168.20.X with a netmask of, so surely the stack can tell how to get to 192.168.20.Y, why do I have that second entry in the routing table?

share|improve this question
up vote 1 down vote accepted

The second line is actually the exact information (as pertaining to routing) you stated in the device configuration.

It would not be sensible to have the kernel always look up infos from the device database for every routing decision if we can put that info into the routing table itself.

Imagine the same situation on a router with several attached networks. The technique seen here applies there as well and simplifies routing decisions by a great deal (Only one line more in the routing table vs. 5 interfaces to scan).

share|improve this answer
This makes a lot of sense, since the interface is in the table as well, one look in the routing table does the trick. – boatcoder Apr 3 '13 at 18:12

It means there is no gateway needed to reach addresses within this subnet, as hosts / NICs with these addresses are in your local network and not behind any router. For all I know such entry is always present except perhaps for some point-to-point-tunnel-only setups, and if you add more addresses to your NIC, each subnet added should yield an entry like that.

Each subnet is listed within the routing table to gather all relevant information in one place for kernel to make routing decisions - it is simply more efficient than looking up connected subnets by analysing the interface configuration and most likely critical for large routers in terms of performance.

share|improve this answer

The second line from your route -n command   U     0      0        0 eth0

Says that for all addresses where the first 3 numbers are 192.168.20 no gateway is needed. is not a legal IPv4 address. Your computer does a logical AND with the destination and the Gen Mask (also known as Netmask) in this case because the first 3 bytes are 255 the first 3 numbers must match exactly. Because the last byte is 0. The last number can be anything.

The first line from your route -n command         UG    0      0        0 eth0

says use this gateway for all other IP addresses. This is probably the address of your router,

share|improve this answer
Yes, the other is the router, I was only questioning the one one that started with – boatcoder Apr 3 '13 at 18:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.