TheFu – Ad-blocking extensions like Adblock Plus are wildly popular among web power users, whether used to kill distracting ads or to make the most of a slow connection. Their weakness: These extensions only work with the browser you’ve installed them on. If you’re interested in blocking advertising from specific domains globally, you can edit your computer’s (or, better yet, your router’s) hosts file to stop your browser, your phone’s browser, or any other application from visiting that advertising server completely.
How Does This Work?
DNS is the telephone book of the internet. Generally, your computer/device uses two methods to locate the other server over the network. In the beginning, only the /etc/hosts file was used. Over time, that file became huge with all the DARPA and University hosts listed. Then DNS was created to turn that lookup into a service for everyone.
Today almost every operating system performs name-to-IP lookups by:
Checking the /etc/hosts file
If not found, sending a DNS query
Any hostname found in the hosts file prevents further queries.
DNS is critical to the security of the Internet too. Any machine that can alter the name-to-IP lookup can trick your system into trusting a remote server with SSL without your knowledge. The safety of every SSL certificate used to protect all your online shopping are completely dependent on DNS.
So, by changing your lookup for an ad-server to point to your local machine, you’ve just shortcut their ability to do anything to your PC. Isn’t that really want you want?
Speeds up your Internet use since the local hosts file by default is checked first, before DNS is used.
Not just for browsers, but works for custom apps like iTunes, RealPlayer, Twitter clients or anything, since it works at the OS name resolution level. It doesn’t care if this is UDP or TCP traffic.
independent; portables, OSX, Linux and even MS-Windows. If the system uses IP (internet protocol), then it has an /etc/hosts file somewhere.
Stops ad tracking too. The hosts file is great if you don’t want to be tracked by them ever again; you won’t need to use “opt-out” cookies either. (My new /etc/hosts file has over 12,000 entries. That’s 12K worth of advertising network hosts that are not using bandwidth as I surf. The old one used for the last decade was only 1200 lines, yet still highly effective. That growth says something about internet tracking these days.)
Blocks spyware and malware too, if those server locations are added to the file. That increases the safety of your networking experience.
Which File exactly?
On OS X and UNIX-like operating systems, the hosts file is located at /etc/hosts.
On Windows, the file is usually at %SystemRoot%system32drivers. (Copy that path, press Win+R, paste that path, and hit Enter.)
Typical hosts files will contain networking entries like this:
How to Edit the Hosts File with a Community Created File
First, find the hosts file by going to the paths above. The hosts file doesn’t have an extension, and if you don’t have a hosts file on your computer already that’s ok. (On Mac, in Finder go to Go > Go To Folder and type in “/etc.” Look for the file called “hosts”).
If you have a hosts file already, make a backup of it to another directory just in case.
You can create your own hosts file, adding different ad servers you hunt down to your list, but that’s a lot of effort. A simpler solution is to use a community created hosts file.