How do I fix "getaddrinfo: localhost Name or service not found" for telnet server?

I need to enable telnet (no i can't use ssh, and I don't want to discuss why I have to use telnet either), I have 127.0.0.1 localhost.localdomain localhost in /etc/hosts. I have installed telnet-server, chkconfigd it on, and enabled xinetd. SElinux is disabled. But every time I try and telnet to the host I get "getaddrinfo: localhost Name or service not known". Any ideas?


Solution 1:

So I realized today that while I did ensure that "localhost" was in /etc/hosts I did not ensure that the system hostname as set in /etc/sysconfig/network was in /etc/hosts. The issue for me is that while the fqdn is in DNS, the standard in this environment is to not use the fqdn for the system hostname. So I stuck the (non-fqdn) hostname in /etc/hosts with the IP address and the issue was resolved.

I guess what has been throwing me off so bad is the error message "getaddrinfo: localhost Name or service not known". The use of localhost is a bit misleading. I hope somone else finds this information useful.

Solution 2:

Did you edit /etc/xinet.d/telnet and set enable to yes (or on, or whatever?)