“host not found” on nxclient connect to nxserver
Cause: my user couldn’t read /etc/hosts
This entry was posted on Friday, April 9th, 2010 at 8:51 am and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
I like this posting because its nice and simple, so responding to it.
Indeed, users should have read permissions on /etc/hosts. This is typical:
ls -l /etc/hosts
-rw-r–r– 1 root root 386 2012-02-16 13:44 /etc/hosts
But that may not be the real problem.
If on the server running the nxserver can not ping localhost like this:
ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=1 ttl=64 time=0.018 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=2 ttl=64 time=0.015 ms
Instead you get something like this:
ping localhost
ping: unknown host localhost
Then something is not right with your DNS lookup methods.
First, verify that the following line exists in /etc/hosts:
127.0.0.1 localhost.localdomain localhost
Next, check your /etc/host.conf, it should have this:
order hosts,bind
multi on
What this means is that for DNS lookups, you should first read the /etc/hosts file before “bind” — which is DNS.. HOWEVER, this is an old way of doing DNS lookups, so there is one more place to checK;
/etc/nsswitch.conf
If you have something similar to the following line, it will NOT work:
hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
Instead, add “files” at the beginning of the value:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Now check that “ping localhost” works.
Finally, if it still isn’t working, verify your routing table:
netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 9.26.118.1 0.0.0.0 UG 0 0 0 eth0
9.26.118.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
If you do NOT have the 127.0.0.0 line for “lo”, then you should add it:
route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
Hope this also helps.