Super User is a question and answer site for computer enthusiasts and power users. 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 recently changed my Hosts file to block some websites in Windows 7. Now I think it is blocking lot of other sites that were not added to Hosts file. Is there any way to escape this?

I tried to replace it with some fresh Hosts file I found online but it doesn't change anything. Some sites are redirected to IIS7. What am I doing wrong?

share|improve this question

migrated from Dec 30 '10 at 17:47

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

Can you post a sample of some of the host file entries? It would be easier to figure out what went wrong if we could see the file. – Ed Manet Dec 30 '10 at 17:46
up vote 6 down vote accepted

The actual location is defined by the following Registry key:


There is no need to turn on, adjust or change any settings with the exception of the DNS Client service (see below). Windows automatically looks for the existence of a HOSTS file and if found, checks the HOSTS file first for entries to the web page you just requested. The is considered the location of your computer, so when the entry (example) "" is requested your computer thinks is the location of the file. When this file is not located it skips onto the next file and thus the ad server is blocked from loading the banner, cookie, or some unscrupulous ActiveX, or JavaScript file.

In case you're wondering, this all happens in microseconds, which is much faster than trying to fetch a file from half way around the world. Another great feature of the HOSTS file is that it is a two-way file, meaning if some parasite does get into your system (usually bundled with other products) the culprit can not get out (call home) as long as the necessary entries exist. This is why it's important to keep your HOSTS file up to date.

In most cases a large HOSTS file (over 135 kb) tends to slow down the machine.

To resolve this issue (manually) open the "Services Editor":

  1. Start > Run > (type) services.msc
  2. Scroll down to "DNS Client", Right-click and select: Properties - click Stop
  3. Click the drop-down arrow for "Startup type"
  4. Select: Manual (recommended) or Disabled
  5. Click Apply/OK and restart

When set to Manual you can see that the above "Service" is not needed (after a little browsing - when set to Manual) by opening the Services Editor again, scroll down to DNS Client and check the "Status" column. It should be blank; if it was needed it would show "Started" in that column.

A better Windows 7/Vista workaround would be to add two registry entries to control the amount of time the DNS cache is saved.

  1. Flush the existing DNS cache
  2. Start > Run (type) regedit
  3. Navigate to the following location:

  4. Click Edit > New > DWORD Value (type) MaxCacheTtl
  5. Click Edit > New > DWORD Value (type) MaxNegativeCacheTtl
  6. Next right-click on the MaxCacheTtl entry (right pane) and select: Modify and change the value to 1
  7. The MaxNegativeCacheTtl entry should already have a value of 0 (leave it that way - see screenshot)
  8. Close Regedit and reboot
  9. As usual you should always backup your registry before editing; see Regedit Help under "Exporting Registry files"
share|improve this answer
Edited to switch to blockquote style so this wouldn't break horizontal scroll. @NaV, I'm assuming this was quote style because you are in fact quoting it - you should make an edit and add your source for further info. – Shinrai Dec 30 '10 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .