"I'm localhost!" "No, I'm localhost!"
Nov. 9th, 2012 11:13 pmThe other day, support managed to find a network with what appears to be several devices all claiming that they're called "localhost".
They were trying to track down some routing issue or other, and the output from the route command was looking something like:
Destination Gateway Genmask Iface 192.168.11.0 localhost 255.255.255.0 eth1 192.168.12.0 localhost 255.255.255.0 eth2 default 192.168.10.254 0.0.0.0 eth0
Naturally, you assume that you've screwed up your network setup, formed of a maze of twisty little ifcfg-eth0 files. Except on the actual server some of the network interfaces were bonded together, several VLANs were in use, and there was a bridge interface as well somewhere (I forget the actual layout and addresses, so this example has been rather simplified). Anyway, as part of trying to track it down someone tried removing the default interface, and got a routing table something like this:
Destination Gateway Genmask Iface 192.168.11.0 192.168.11.254 255.255.255.0 eth1 192.168.12.0 192.168.12.254 255.255.255.0 eth2
Naturally, you assume that the network scripts are doing weird and unhelpful things. And so you spend ages poking things in an attempt to make sense of the output without managing to make any headway.
Eventually someone tried running "route -n" instead of plain "route", and got this:
Destination Gateway Genmask Iface 192.168.11.0 192.168.11.254 255.255.255.0 eth1 192.168.12.0 192.168.12.254 255.255.255.0 eth2 0.0.0.0 192.168.10.254 0.0.0.0 eth0
WTF?
It turned out that if you asked the DNS server on that network to do a reverse lookup for, say, 192.168.11.254, it told you that that the hostname for that address was "localhost". As was the hostname for 192.168.12.254, or for several other addresses.