Localhost route missing
Charles Steinkuehler
charles at steinkuehler.net
Tue Sep 28 17:40:36 CDT 2004
Jon Moss wrote:
> A couple of weeks ago, when I was having trouble with my web server, I
> noticed that I don't have a localhost route:
>
> ]$ cat hosts
> # Do not remove the following line, or various programs
> # that require network functionality will fail.
> 127.0.0.1 lumcweb localhost.localdomain localhost
> 192.168.0.33 lumcweb.localdomain lumcweb
> 192.168.0.25 MossLinux MossLinux
> 24.94.162.101 smtpserver
> ]$ netstat -r
> Kernel IP routing table
> Destination Gateway Genmask Flags MSS Window irtt
> Iface
> 192.168.0.0 * 255.255.255.0 U 0 0 0 eth1
> 169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
> default 192.168.0.1 0.0.0.0 UG 0 0 0 eth1
>
> Yet my hosts files includes it. This server is running Fedora Core 2.
>
> I can also ping the localhost just fine:
>
> PING lumcweb (127.0.0.1) 56(84) bytes of data.
> 64 bytes from lumcweb (127.0.0.1): icmp_seq=0 ttl=64 time=0.071 ms
> 64 bytes from lumcweb (127.0.0.1): icmp_seq=1 ttl=64 time=0.063 ms
> 64 bytes from lumcweb (127.0.0.1): icmp_seq=2 ttl=64 time=0.060 ms
> 64 bytes from lumcweb (127.0.0.1): icmp_seq=3 ttl=64 time=0.063 ms
>
> Should I be concerned?
Probably not...the routes for local are kind of 'hidden'...for example
on my debain box (using the iproute command...your FC box will look
similar..."up2date iproute" (or however that works now) if you don't
have iproute installed):
<quote>
ada:~# ip rule list
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
ada:~# ip route list table local
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 65.16.44.223 dev eth0 proto kernel scope link src 65.16.44.212
local 65.16.44.212 dev eth0 proto kernel scope host src 65.16.44.212
broadcast 65.16.44.208 dev eth0 proto kernel scope link src 65.16.44.212
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
ada:~# ip route list table main
65.16.44.208/28 dev eth0 proto kernel scope link src 65.16.44.212
default via 65.16.44.209 dev eth0
ada:~# ip route list
65.16.44.208/28 dev eth0 proto kernel scope link src 65.16.44.212
default via 65.16.44.209 dev eth0
ada:~# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
65.16.44.208 * 255.255.255.240 U 40 0 0 eth0
default host44-209.disc 0.0.0.0 UG 40 0 0 eth0
</quote>
Note the local routes are in the local table, but the default table used by
routing tools is 'main'. For a more detailed description of how this all works,
see the Linux Advanced Routing and Traffic Control HOWTO:
http://lartc.org/
Chapter four introduces you to the routing policy table (ip rule list), and
some of the things you can do with it...
--
Charles Steinkuehler
charles at steinkuehler.net
More information about the Kclug
mailing list