Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Suppose example.com points to 1.2.3.4 IP address.

I want to be able to put something.example.com in my Windows hosts file so that it goes to another IP address. I've defined it as such in the hosts file.

9.8.7.6 something.example.com

When I ping something.example.com I still get 1.2.3.4 and when I visit the URL, it still resolves the website on 1.2.3.4 instead of from where I want, 9.8.7.6

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Did you place your hosts file in: C:\Windows\System32\drivers\etc with this syntax:

102.54.94.97 rhino.acme.com

share|improve this answer
    
Also, you must be administrator to save it, so if windows 7: Click Start – search for “Notepad“, right-click and select “Run as Administrator“ then open the hosts file –  IT_Fixr Jun 29 '11 at 23:25
1  
The actual issue was, I had to restart my computer. :-/ Strange but true. –  FinalForm Jun 29 '11 at 23:42
3  
That's a little odd, host file changes should take immediately. Though a cached DNS lookup may take precedence. Did you try ipconfig /flushdns ? –  SpacemanSpiff Jun 30 '11 at 0:33
    
The hosts file should take effect immediately and entries in the hosts file should replace matching entries in the DNS resolver cache upon saving the hosts file. I'm pretty sure that running ipconfig/flushdns will preload the DNS resolver cache with entries from the hosts file along with clearing the DNS resolver cache of entries not contained in the hosts file. –  joeqwerty Jun 30 '11 at 3:59

Perhaps the local resolver cache is queried first? Does running 'ipconfig /flushdns' perhaps resolve the issue?

share|improve this answer

Your Answer

 
discard

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.