telnet fail getaddrinfo: localhost Name or service not known
This crippled a client's system this morning, and I thought I'd share the fix:
Trying to telnet into the system:
# telnet 192.168.10.3
Connected to 192.168.10.3 (192.168.10.3).
Escape character is '^]'.
getaddrinfo: localhost Name or service not known
Connection closed by foreign host.
The fix was to add an entry to /etc/hosts
# grep HOSTNAME /etc/sysconfig/network
Then make an entry in /etc/hosts for the HOSTNAME exactly as it appears in the results from the above grep command, using the IP address of the network card.
This can be obtained using
# grep HOSTNAME sysconfig/network
eth0 Link encap:Ethernet HWaddr 00:25:B3:B9:14:4A
inet addr:192.168.10.3 Bcast:192.168.10.255 Mask:255.255.255.0
The entry to put in /etc/hosts would then be:
Now, what is peculiar is that the server has been running for months and telnet working just fine.
I'm guessing that automatic updates "fixed" something that wasn't necessarily broken, from the end-user's perspective.
Last edited by jijawm; 09-01-2010 at 05:36 PM.