Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Under Linux, the /etc/hosts file can be used to override dns definitions, i.e. to point an hostname to a different ip.

I need to test a new VPS. So I added a line in the /etc/hosts file: www.mywebsite.com

I flushed all caches and went to www.mywebsite.com , but it still shows the old site. In the new site, I should see the default apache file "It Works!"

I used ping to test the ip and it shows the new ip.

I used wget to retrieve the index.html file, but it retrieves the file from the old server.

I use DNS Flusher Firefox add on to clear DNS cache. I also check using Midori browser private browsing (it doesn't cache DNSs).

For testing purposes, I added a line for facebook: www.facebook.com

I works fine, i.e. I see a "connection timed out" message, after a redirection from http:// to https://

I added another line: stackoverflow.com

This time, I see the normal stackoverflow website.

If I add: www.mywebsite.com

I see a not found message from local server.

I checked using Windows and saw the same behaviour.

Why can't I point a hostname to a new IP ?

Thanks for your help!

Edit: I bypassed my router to check if it¡s something related with it, but it isn't.

share|improve this question

migrated from stackoverflow.com Aug 17 '13 at 17:20

This question came from our site for professional and enthusiast programmers.

Juan: Do you have nscd running on your computer? ⫽ @Flimm: Which doesn't make much sense, since the entire question is about overriding DNS. host does not use the generic name lookup functions that wget or a browser would. –  grawity Aug 17 '13 at 18:28
@grawity: Huh you're right about host. –  Flimm Aug 17 '13 at 18:33
Test your DNS using ping example.com and getent hosts example.com on the command-line. –  Flimm Aug 17 '13 at 18:33
Thanks, I don't have nscd installed. –  Juan Carlos Aug 17 '13 at 18:49
ping mywebsite.com gives me the new IP. wget mywebsite.com shows me the old website. –  Juan Carlos Aug 17 '13 at 18:50

Your Answer


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

Browse other questions tagged or ask your own question.