How does one interpret the routing table that is generated by the netstat -r command?

  • This could probably be flagged 'community wiki'. – Kyle Smith Oct 23 '09 at 14:49
  • OK I added the tag – Brian Wigginton Oct 23 '09 at 15:15

Assuming you mean Linux:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     1      0        0 eth0
link-local      *          U     1000   0        0 eth0
default         UG    0      0        0 eth0

The table defines the route to be taken based upon the destination address of a connection. The Destination and Genmask fields are combined to produce a subnet of addresses to which a rule applies. On most systems you have a simple routing table like mine, above. A gateway address of "*" implies that the packets will simply be sent out the interface to reach their target destination. Rule 1 for example, is for reaching systems in my local LAN.

A default rule is usually displayed at the bottom, which is the router to which the packets are sent if no other rules match.

If you paste your routing table with specific rules that are confusing, I could provide more detail.

  • On Macs, it seems the routing table is upside down, that may have been adding to my confusion. – Brian Wigginton Oct 23 '09 at 15:17
  • Interesting, I'll have to check mine when I get home. – Kyle Smith Oct 23 '09 at 16:10
  • Don't rely on the order. It's not first match, but most accurate (most bits in the mask). There's usually an exception that "connected" networks rate above any other routes. – LapTop006 Oct 25 '09 at 13:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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