I set a new hostname on my machine using:

sudo hostname NEWHOSTNAME

Then I restarted, and tried accessing the internet and nothing happened. I checked the hostname and it was set to localhost.localdomain.

How can I reset my configurations so that I am again connected to the web?

I'm running Red Hat Enterprise 6.0 (Santiago)

  • what exactly did you do to change the hostname?
    – Wojtek
    Commented May 21, 2012 at 14:03
  • I did: sudo hostname NEWHOSTNAME
    – SortingHat
    Commented May 21, 2012 at 14:15
  • 2
    This changes the hostname until you reboot. Maybe you did something else ?
    – Ben D
    Commented May 21, 2012 at 16:34
  • Agreed with @BenD: the original hostname would be restored after the reboot.
    – Wojtek
    Commented May 21, 2012 at 16:48
  • Thanks guys, I wasn't sure if it was a persistent change or not. Thanks for all the info!
    – SortingHat
    Commented May 21, 2012 at 18:22

3 Answers 3


Your hostname should have nothing to do with being able to connect to the internet. That is unless the DHCP server on your network assigns IP addresses based on hostname (which if it does, it's a big mistake).

If the internet loss you mention is on a home network, consider restarting your local router. If it's a public or work network, unplug the cable/disable wireless, wait a few seconds and try plugging/enabling again.

If you still have problems, ask your local administrator. If you are your local administrator, follow the steps here or ask for support.


In centos 6, clean. I change the /etc/hosts file to add a fqdn, like: mail.sla.com mail

before I change the file /etc/systemconfig/network an add a name different a localhost.localdomain, like:


next, I execute yum install bind, and result is "couln't find centos.mirror...."

ping to dns of isp... nothing

What would be the explanation for that?


As someone already mentioned, check the file /etc/sysconfig/network





the HOSTNAME entry on this file will make the hostname of the server permanent after restart.

Restart nettwork

$ service network restart

Ping the entry GATEWAY IP address to check connectivity. If this is a home network, it would be your router.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .