Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

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

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.

share|improve this answer

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?

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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