Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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

2 Answers 2

up vote 2 down vote accepted

Assuming you mean Linux:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.17.184.0     *               255.255.248.0   U     1      0        0 eth0
link-local      *               255.255.0.0     U     1000   0        0 eth0
default         10.17.184.1     0.0.0.0         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.

share|improve this answer
    
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

 
discard

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.