Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want all requests from my machine to

be redirected to

I tried adding the following line to the hosts file both on Windows and Linux

but the nslookup still resolves to the old IP.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The hosts file expects an IP address for each hostname listed.

You may need to look up the IP address of and use it in the hosts file.

First perform the DNS lookup:


Non-authoritative answer:

Then add a line line in your hosts file such as:


But keep in mind that if ever changes its IP address, then you will have to make a corresponding change in your hosts file.

share|improve this answer
it worked for pings but my nslookup still resolves for the old IP –  Jader Dias Jan 7 '10 at 13:27
@Jader Dias: do an ipconfig /flushdns and give it another try. That'll flush your resolver cache, maybe you've got the old records still stuck in the cache. –  squillman Jan 7 '10 at 13:30
I tried it too, but it didn't work. Maybe nslookup doesn't looks into the hosts file (try nslookup localhost). –  Jader Dias Jan 7 '10 at 13:33
If you want nslookup to behave as described in the above comments, then consider running your own DNS server and pointing your client(s) to that DNS server, such as PowerDNS. –  eleven81 Jan 7 '10 at 13:39

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.