LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   telnet fail getaddrinfo: localhost Name or service not known (http://www.linuxquestions.org/questions/linux-server-73/telnet-fail-getaddrinfo-localhost-name-or-service-not-known-828644/)

jijawm 08-26-2010 11:34 AM

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
Trying 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
ifconfig

e.g.
# grep HOSTNAME sysconfig/network
HOSTNAME=g6network
# ifconfig
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:
192.168.10.3 g6network

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.

c19191919 10-21-2013 03:19 PM

Telnet no accepting connections
 
Your post worked perfectly.


All times are GMT -5. The time now is 11:52 PM.