Super User is a question and answer site for computer enthusiasts and power users. 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

Typing the command:

% route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     2      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
(... hang for a while ...)
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0

Here, before the last line default rule be printed, route just hang for while.

Isn't the route table cached somewhere?

I used to grep the result from route to get the default rule, to get the default gateway. Now, route seems hang for a while in some machines.

share|improve this question
2  
BTW, it would be more efficient to parse the /proc/net/route file for that information. – Keith Jun 2 '11 at 3:31
    
The IPs are encoded in hex numbers in /proc/net/route. – Xiè Jìléi Jun 2 '11 at 5:06
2  
Yes. so you can convert them. If you can't, the output of ip route is also easier to parse. – Keith Jun 2 '11 at 6:53
up vote 12 down vote accepted

It's trying to do a reverse DNS lookup on the gateway address, and waiting for timeout. Try running with the -n option to suppress that.

share|improve this answer

You may have some DNS related problems. Try the following to check it out:

$ cat /etc/resolv.conf
nameserver <IP_1>
nameserver <IP_2>
search <DOMAIN>

host www.google.com <IP_1>

host www.google.com <IP_2>

If everything is working fine, you shouldn't get any delays while executing 'route' command

Regards

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .