Tools: simple ADS blocking in Windows XP/7/8/10

Domain Name Servers (DNS) bind the internet together. They match machine-usable IPv4 and IPv6 addresses with human-readable domain names. I...


Domain Name Servers (DNS) bind the internet together. They match machine-usable IPv4 and IPv6 addresses with human-readable domain names. It's the internet's equivalent of the phone book. But, while DNS is utterly essential to the internet, it's not the only way to connect IP addresses with domain names. You can also use Hosts files to connect mysterious IP addresses with meaningful domain names.

A Hosts file is a file that almost all computers and operating systems can use to map a connection between an IP address and domain names.

This file is an ASCII text file. It contains IP addresses separated by a space and then a domain name. Each address gets its own line. For example, 64.30.228.118 is the IP address for CBS Interactive, ZDNet's parent company.

To place this in a Host file you'd enter the following line with a text editor, such as Windows' notepad or Linux's vi.

64.30.228.118 cbsinteractive.com

You never want to use a word processor to create or edit a Hosts file.

To be a valid Host files entry, you can't use website designations such as \, /, or http://. If you put a hash tag, #, at the line's start, you've disabled that entry. The Hosts file will ignore it and move to try find the site via DNS. When an entry is valid, your computer will use the address mapping in the Hosts file and not look it up in DNS.

Why bother when your DNS provider automatically looks up addresses for you? Well there are two main reasons.

First -- and this is minor -- when you go to a site that's in your Hosts file, it will resolve the address a few milliseconds faster than it would if your computer looked it up on DNS.

Using this to speed up your address resolution is too much trouble. If you're always visiting the same sites -- and most of us are -- you'd be better off using the lightweight caching Dnsmasq DNS server. This program automatically saves your DNS queries so that the next time you visit a site, your computer looks it up in the local Dnsmasq cache instead of wasting time going to DNS. This can save as much as 50 percent of your DNS lookup time.

Where Hosts files really shine is by letting you block ads, spyware sites, malware sites, and tracking sites. It does this by blocking your computer from connecting to annoying sites. Specifically, you can list the sites you never want to visit in the Hosts file and give them the loopback address of 127.0.0.1 using IPv4 addressing or ::1 for IPv6 addressing.

What happens then is when a site, email, or what-have-you tries to steer you to a dodgy address, the Hosts file bounces it back and you're kept from going to the questionable domain.

Now you may ask yourself "how do you know which sites to avoid?" Good question, there are thousands of them.

Fortunately, there are three host files ready to go, which include a large list of known ads servers, tracking cookies sites, and other web locations you'll want to avoid. These are: How to make the internet not suck (as much), which despite the name is quite good, hpHosts, and MVPS Hosts. There's also the Hosts File Project, but unlike the others, which are frequently updated, Hosts File Project file hasn't been updated in over a year.

To use any of these, you must first make a backup of your existing Hosts file. On some operating systems you may not have one. I typically rename my existing file hosts.old.

You then create a file named "hosts". You never use an extension with the name, such as hosts.txt, you just use "hosts".

Where you put your new and improved hosts file depends on your operating system and its version. There are several ways to do this. For Windows, MVPS includes an installation routine. With the others, you simply copy and paste their master hosts file to the appropriate destination on your computer.

Before installing a hosts file on a Windows system that's not part of a domain, you must disable the Windows DNS Client Service. To do this, login with an administrative account and click Start, Run and type "services.msc" and click OK. Double click DNS Client service entry, set its startup type to manual and stop the service.

The security program Windows Defender can also get in the way. It can detect changes to the Hosts file as malware activity. To prevent this from happening, you need to tell Defender to ignore the Hosts file. You do this with the following steps:

1. Open Windows Defender.

2. On the Settings tab, click Excluded files and locations.

3. Under File locations, click Browse.

4. Locate and then click the Hosts file. Note By default, the Hosts file is in the %systemroot%\system32\drivers\etc folder.

5. Click Add, and then click Save changes.

6. Exit Windows Defender.

After you've done this, you can install the hosts file in one of the following locations:

For NT, Win2K and XP, use "C:\windows\system32\drivers\etc\hosts" or "C:\winnt\system32\drivers\etc\hosts"

For Windows 7 and Vista, use "C:\windows\system32\drivers\etc\hosts" or "%systemroot%\system32\drivers\etc\hosts"

For Windows 8.x and Windows 10, use "C:\Windows\System32\drivers\etc\hosts"

With Linux or MacOS X, you login as the root user, or use sudo, to move the master hosts file to "/etc/hosts" or on some systems to "/private/etc/hosts". For example, the shell command

sudo cp ~/hosts /etc/hosts"

will move the file "hosts" from your home directory to its home in the etc directory.

Once the host file is in place, you'll see the effects immediately. You don't need to reboot, or, for that matter, reopen your browsers.

You should see a much cleaner and faster internet experience. If you run into problems, revise the hosts file using a text editor if you can see which address is giving you trouble. For example, the how to make the internet not suck (as much) hosts file blocks all Windows 10 reporting domains by default. To fix this you can either delete the offending entry or you can place a # at the beginning of the line and your machine will ignore it.

If all else fails, you can just delete the new hosts file and replace it with the old one. You did make a backup of it right? Right!?

All this will take you a bit of time and effort, but I think you'll find that your increase in speed and privacy and drastic drop in ads will make it worth your time. Enjoy.

HOW TO MODIFY THE HOST FILE

HOSTS File for Windows is the default HOSTS file for Windows 7, 8, and 10 provided for anyone not comfortable manually editing their HOSTS file.


Many security and privacy programs can edit your HOSTS file, and it can cause problems. For example, the Microsoft Store might be blocked, and you don't know why. There are thousands of possible problems a HOSTS file could be the fault of. If you suspect your HOSTS file is the problem, download, or copy the code below and make your own.


The hosts file works with all versions of windows, in most operating systems use a hosts file including your android phone. When editing the hosts file simply make the changes and then save the file, but since windows will not allow you to save it where it resides, save it to your desktop and then manually copy it to C:\windows\system32\drivers\etc. You will be prompted to overwrite the file select yes. Remember when you finish editing the hosts file to strip off the extension ".txt" for it to work. There is no need to reboot your system, just close and re-open your browser of choice. When editing the host file on android phones you will need to reboot the phone. for the changes to take effect
Additionally do not use your WAN IP in the hosts file. you should use either
0.0.0.0
or
127.0.0.1
Your IP address can change too often
Windows 7,  Windows 8/8.1 and Windows 10
  • Press the Windows key.
  • Type Notepad in the search field.
  • In the search results, right-click Notepad and select Run as administrator.
  • From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts.
  • Make the necessary changes to the file.
  • Select File > Save to save your changes.
Your HOSTS file can be opened and edited with Notepad. You can find it in C\:Windows\System32\drivers\etc


Here is what a default HOSTS file looks like:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

Related

Tools 7422248500838445405

Post a Comment

emo-but-icon

Follow Us

News

Hot in week

Recent

Comments

FACEBOOK

item