I am trying to change the hostname on a Linux RHEL6.5 box and have changed it in /etc/hosts and in /etc/sysconfig/network, as I have read..

The command hostname'now returns the new hostname, but hostname -A returns the old one, and I still cannot connect to the machine using the new one.

I have restarted the network service and everyting, restarted the box, but still no luck.

Can someone please explain why this isn't working for me?

  • 2
    I still cannot connect to the machine using the new one. Are you doing this from the same machine or from a different machine? Cause if it is from the different machine then it must ask DNS to resolve a name and it seems you have not added the new name to DNS. – Sergey Kurenkov Mar 31 '16 at 18:49
  • Have you tried hostname $new_hostname? – Elronnd Apr 1 '16 at 4:03

Try running the following from the system you are trying to connect from:

nslookup <new hostname>

I suspect you'll get:

** server can't find thisdoesntexist.com: NXDOMAIN

In which case, you need to update your DNS server with the new hostname.


I believe you also need to put it in /etc/hostname and a reboot is advisable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.