How To Guides Org

Secure Windows With This Hosts File (Block Malware, Ads & More)

Ok, let’s cut to the chase. If your PC has an internet connection you are in danger, every minute. As you might know you can use the hosts file to your advantage and rewrite all those nasty URL’s to block malware, ads and other malicious sites.


About: What is a hosts file?

A hosts file maps hostnames to IP addresses, e.g. google.com to 1.2.3.4.5.7 (it’s another one). You can use this for your advantage by resolving (translating) addresses of malicious websites to “localhost” (127.0.0.1) which is basically your local IP. If it resolves to localhost, the query will fail and the website will NOT load.

Why A Secure Hosts File Matters

How does this help? The hosts file you are about to download has hundreds of entries of malicious websites. If they don’t resolve properly they can not spread malware, viruses or cookies, because the adverts will simply not load.

Hosts File: Performance vs. Security

You have to set priorities! What do you want? Performance or security? The larger your hosts file the slower your internet might be. If you have many entries in your hosts file this can significantly slow down your browser. Luckily, we have some workarounds to combine performance and security.

Download & Install MVPS HOSTS File

1. Step Head over to http://www.mvps.org/winhelp2002/hosts.htm and check out the hosts file, it’s a pretty darn long one. Also make sure to check out http://www.mvps.org for further instructions!

2. Step While the page is open hold down CTRL + A, then copy all entries into the clipboard via CTRL + C

2. Step Open an elevated command prompt

3. Step Enter notepad C:/windows/system32/drivers/etc/hosts

4. Step In the notepad program click just below the commeted area (###) and hold down CTRL + V to insert all URL’s that we copied in step (2)

5. Step Save the file (CTRL + S)

Large Hosts File: Performance BOOST

If you modify some registry keys you can define the time those records are kept in the DNS cache, which will greatly increase your website loading speed.

6. Step Download this registry key: DNS Cache Time TTL (Time to Live)

Verify the content to be:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dnscache\Parameters]
“MaxCacheTtl”=dword:00000001
“MaxNegativeCacheTtl”=dword:00000000

7. Step Double-click on the registry file to apply it.

8. Step Reboot.

Hopefully this will make your PC a little bit more secure.

Still Slow? Performance Tip

It also helps if you regularly flush your DNS cache. Here’s how: Flush DNS Cache

Related