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

I've edited my HOSTS file on my Windows 7 Ultimate PC to re-route a couple of URLs so that they point to 127.0.0.1, but after saving the file (and re-opening to verify the changes were written) and pinging them they still reply with the actual IP instead of being redirected to 127.0.0.1 as they should be. At least, that's how it worked in XP, Vista, etc. I even went so far as to restart my DNS service on the machine via services.msc; but no dice.

So - I would imagine that Windows 7 keeps the HOSTS file there for legacy purposes and doesn't actually use it anymore. Is there a way to make W7 pay attention to the HOSTS file? In the event that you can't do that, where would I go to edit where these URLs point to?

Thanks in advance!

-Sootah

share|improve this question
Win7 does use its hosts file, I use it here to translate my router's ip into a hostname to speed up tracert. – Richard Jul 7 '10 at 8:32

3 Answers

up vote 3 down vote accepted

Alrighty guys, apparently Win7's hosts file is screwy in some way. If you copy the contents of the file and then paste it into a new txt document (Notepad), then go and delete the original hosts file out of Windows\System32\Drivers\etc followed by saving a new copy of hosts (in the etc directory, obviously) then it works.

I had this problem on both my Win 7 desktop as well as my laptop and the copy/delete/save new method worked on both.

share|improve this answer
+1 this did it for me also. Very strange, as I literally copy pasted the exact contents of my old file into a new file, and it suddenly started working... – elwyn May 28 '11 at 23:21

First, make sure your DNS Cache is empty:

ipconfig /flushdns

Then, go to the properties of your network device, in the advanced settings of the Internet Protocol you can enable the LMHOSTS look-up functionality, it should work if both were done; Windows 7 still supports the HOSTS file like in previous versions.

share|improve this answer
LMHOSTS is checked in the adapter's IPv4 settings, I've run ipconfig /flushdns, rebooted, etc and it still doesn't work. Do I have to do the manual "import LMHOSTS" deal? If so, what format is an LMHOSTS file in? Ideas? – Sootah Jul 6 '10 at 23:04
Maybe that could work, it's somehow not loading the hosts file as it should be doing. I think the LMHOSTS are written in the same way, see: en.wikipedia.org/wiki/LMHOSTS – Tom Wijsman Jul 6 '10 at 23:54

I had the same problem and was due to Trend Micro Antivirus. Go to your network device, in the properties (where you can see the IPv4, IPv6, etc.) uncheck the checkbox for "Trend Micro NDIS 6.0 Filter Driver". Wasn't enought deactivating the firewall! If you have installed another antivirus solution check if it's interfering.

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.