Error Msg Fail: How to enable telnet on centos/rhel

Don’t even start with me about how telnet is horrid. Out side of my control but I recently had issues trying to enable telnet on a server. Typically its pretty straightforward.

  1. yum install telnet-server
  2. chkconfig telnet on
  3. chkconfig xinetd on
  4. service xinetd start

Unfortunately for me this was not working. Every time I tried to telnet to the host after enabling it I would get an error message.

telnet host
Connected to host (
Escape character is '^]'.
getaddrinfo: localhost Name or service not known
Connection closed by foreign host.

I tried everything I could think of, selinux disabled, ensure localhost in /etc/hosts, connect to ip instead of hostname. Nothing was working. All of my searching was just turning up the obligatory “Don’t use telnet, use ssh”.

While that is generally good advice, in the event you are restricted to using telnet it’s not very helpful. Obviously is something related to name resolution. From both sides the fqdn was resolvable. Then it dawned on me. This environment also has the standard of not using the fqdn as the hostname as set in /etc/sysconfig/network. I had not ensured that the shorthand hostname was resolvable. I resolved the error by adding the hostname in /etc/hosts, but adding a default search domain in /etc/resolv.conf would work just as well.

This leads me back to the error message. Really it had nothing to do with “localhost” or “”. Had it said “host” Name or service not known I would have chased down the issue much sooner.

My ServerFault plea for help


  • KiwiGee Windows Vista Firefox 16.0 wrote:

    Good call.
    There must be lots of home linux boxes out there with a hostname defined but not in the hosts file.

    PS – love your captchas !!!!

  • Buggy Linux Firefox 17.0 wrote:

    Brilliant! I had the same problem with the same answers, “Use SSH!”. Sadly we have an ancient database that needs telnet to be happy. Thanks so much for this information. I have been goofing off with this for several hours until I happened to query Google properly and then found your very correct solution.

Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha