Block Ads Using the hosts File



Similar documents
Enabling Java and ActiveX Settings of Internet Explorer:

How To Upgrade A Websense Log Server On A Windows 7.6 On A Powerbook (Windows) On A Thumbdrive Or Ipad (Windows 7.5) On An Ubuntu (Windows 8) Or Windows

SQL Injection Attack Lab

Get Started Guide - PC Tools Internet Security

Apache Server Implementation Guide

PAC File Best Practices with Web Security Gateway and Web Security Gateway Anywhere

Setting Up a Development Server

RealPresence Platform Director

NEW AND IMPROVED! INSTALLING an IRC Server (Internet Relay Chat) on your WRT54G,GS,GL Version 1.02 April 2 nd, Rusty Haddock/AE5AE

You can specify IPv4 and IPv6 addresses while performing various tasks in this feature. The resource

Installation Guide For Choic Enterprise Edition

OUTLOOK ADDIN V1.5 ABOUT THE ADDIN

Introduction. What is Unbound and what is DNSSEC. Installation. Manual for Unbound on Windows. W.C.A. Wijngaards, NLnet Labs, October 2010

How to Install SMTPSwith Mailer on Centos Server/VPS

Sophos Anti-Virus for Mac OS X Help

Reference Guide for WebCDM Application 2013 CEICData. All rights reserved.

ADOBE FLASH PLAYER Local Settings Manager

Implementing Reverse Proxy Using Squid. Prepared By Visolve Squid Team

Introduction. Installation of SE S AM E BARCODE virtual machine distribution. (Windows / Mac / Linux)

Ensim WEBppliance 3.0 for Windows (ServerXchange) Release Notes

Sophos Anti-Virus for Mac OS X: Home Edition Help

SpamTitan Outlook Addin V2.0

Running the Tor client on Mac OS X

How to connect your new virtual machine to the Internet

How to Setup and Connect to an FTP Server Using FileZilla. Part I: Setting up the server

How Web Browsers Work

Polycom RealPresence Resource Manager System Getting Started Guide

Using Webmin and Bind9 to Setup DNS Sever on Linux

Chapter 6 Virtual Private Networking Using SSL Connections

Getting Started with PRTG Network Monitor 2012 Paessler AG

Streaming Media System Requirements and Troubleshooting Assistance

VMware vcenter Log Insight Getting Started Guide

VMware vcenter Support Assistant 5.1.1

BlackBerry Enterprise Server Express for Microsoft Exchange. Version: 5.0 Service Pack: 4. Upgrade Guide

Compiere ERP & CRM Installation Instructions Windows System - EnterpriseDB

Ajera 7 Installation Guide

How to Configure URL Filtering Using the Firewall s HTTP Proxy

Kollaborate Server Installation Guide!! 1. Kollaborate Server! Installation Guide!

Table of Contents Recommendation Summary... 3 Introduction... 4 Formatting Recommendations... 5 Creative:... 7 Deliverability & Infrastructure:...

SIMGallery. User Documentation

DNS and BIND Primer. Pete Nesbitt linux1.ca. April 2012

ANALYSING SERVER LOG FILE USING WEB LOG EXPERT IN WEB DATA MINING

Cisco Unified Workforce Optimization

LOCKSS on LINUX. CentOS6 Installation Manual 08/22/2013

Virtual Private Server Manual

How To Use Moodle Online Class On A Pc Or Mac Or Ipad (For Acedo) On A Computer Or Mac) On Your Computer Or Ipod Or Ipo (For An Ipo) For Acedor Or Mac (

Setup a Virtual Host/Website

Lets Get Started In this tutorial, I will be migrating a Drupal CMS using FTP. The steps should be relatively similar for any other website.

Plesk 11 Manual. Fasthosts Customer Support

Installation and User Guide Zend Browser Toolbar

Instructions for Configuring Your Browser Settings and Online Security FAQ s. ios8 Settings for iphone and ipad app

Microsoft. Pro: Upgrading to Windows 7 MCITP Enterprise Desktop Support Technician.

User Guide to the Snare Agent Management Console in Snare Server v7.0

Troubleshooting Windows monitoring 2007 Intellipool AB

Grandstream Networks, Inc.

Glossary of Technical Terms Related to IPv6

How do I install Active Directory on my Windows Server 2003 server?

Installing and Configuring vcenter Support Assistant

Taleo Recruiting 7.5. Technical Requirements and Configuration Guidelines for Candidates. Software Version: 7.5 SP11

Snare Agent Management Console User Guide to the Snare Agent Management Console in Snare Server v6

reviveads AD BLOCK PREVENTION

Local Caching Servers (LCS): User Manual

Modelling with R and MySQL. - Manual - Gesine Bökenkamp, Frauke Wiese, Clemens Wingenbach

Movie Instructions: Downloading, Saving, & Watching

Local DNS Attack Lab. 1 Lab Overview. 2 Lab Environment. SEED Labs Local DNS Attack Lab 1

Introduction to cpanel

Outpost Network Security

Using Symantec NetBackup with Symantec Security Information Manager 4.5

SIMIAN systems. Setting up a Sitellite development environment on Mac OS X. Sitellite Content Management System

Fasthosts Internet Parallels Plesk 10 Manual

Automating client deployment

The Barracuda Network Connector. System Requirements. Barracuda SSL VPN

Setting up VNC, SAMBA and SSH on Ubuntu Linux PCs Getting More Benefit out of Your Local Area Network

Comodo MyDLP Software Version 2.0. Endpoint Installation Guide Guide Version Comodo Security Solutions 1255 Broad Street Clifton, NJ 07013

ISA Server Plugins Setup Guide

Novell ZENworks 10 Configuration Management SP3

SecureAware on IIS8 on Windows Server 2008/- 12 R2-64bit

BA.NET ADBLOCK ADMINISTRATOR MANUAL ADBLOCK AND WEB SECURITY BA.NET DNS FILTER SERVER ADMINISTRATOR MANUAL

Introduction to the AirWatch Browser Guide

Intelligent Office: Web Optimisation Guide. Published Date: 06/11/2015. Version: 3.3

Configuring your network settings to use Google Public DNS

LOCKSS on LINUX. Installation Manual and the OpenBSD Transition 02/17/2011

SCADA Security. Enabling Integrated Windows Authentication For CitectSCADA Web Client. Applies To: CitectSCADA 6.xx and 7.xx VijeoCitect 6.xx and 7.

WatchGuard Dimension v1.1 Update 1 Release Notes

Table of Contents. Oracle/Sun JRE Upgrade Instructions. Verify Hard Disk Space JRE

ModusMail Software Instructions.

Adobe Flash Player and Adobe AIR security

Central Configuration Using File Server

How to train your Browser Controller

Perforce Helix Threat Detection OVA Deployment Guide

How To Understand The History Of The Web (Web)

Network Connect Installation and Usage Guide

HC8 Installation Guide

SQL Injection Attack Lab Using Collabtive

How to. Install Active Directory. Server 2003

readme_asm.txt README.TXT

Compiere 3.2 Installation Instructions Windows System - Oracle Database

Transcription:

Block Ads Using the hosts File Online ads displayed in web pages are annoying. Is there a way to reduce or eliminate them at the system level instead of installing browser plugins? One effective way to prevent ads from appearing is to prevent the computer from making connections to them in the first place. This conserves bandwidth because if no connection is made to the ad server, then its content cannot be downloaded. A simple method to achieve this is by editing the /etc/hosts file. What is /etc/hosts? This is a text file that resolves domain names to IP addresses. Whenever a domain name is entered in the URL bar of a web browser, it must first be resolved into an IP address to find the site on the Internet. Usually, this involves a DNS lookup by connecting to a DNS server, which returns the IP address. However, before the DNS lookup is performed over the Internet, Linux checks the /etc/hosts file to see if the domain name can be resolved locally. If so, Linux uses that IP address without any further DNS resolution. How Is This Useful? We can use this to our advantage by associating known ad domain names with null or local IP addresses.

For example, if Linux sees the domain name http://www.nastyadserver.ads, it will check to see if there is a valid entry in /etc/hosts and use the associated IP address if found. We can put a bogus IP address, such as 0.0.0.0, in /etc/hosts for the www.nastyadserver.ads domain, and Linux will use 0.0.0.0 instead of finding the real IP address through a DNS lookup. Since 0.0.0.0 goes nowhere, the ad is never loaded. This helps conserve bandwidth. Rather than downloading everything and then filtering out the junk before display, blocking the junk at the DNS lookup level prevents it from downloading in the first place. What Is Blocked? Everything that requires a DNS lookup is blocked. This includes malicious scripts, web bugs, ad servers, cookies, page counters, Flash ads, and other tricks advertisers use to clutter a page and monitor a user. Entire sites can be blocked. Don t like googleanalytics? Then, block it in /etc/hosts by mapping it to 0.0.0.0. Are some sites offensive? Block them too in the same way. Again, since the DNS lookup is never performed, the connection is never made. Of course, this does not work with direct IP addresses. Entering 192.168.1.1 in a browser s URL bar will load whatever is located at 192.168.1.1 regardless of what /etc/hosts instructs. Obtaining a Pre-Made hosts File There is a project that seeks to maintain an updated hosts file containing a list of known ad servers. This page, titled Blocking Unwanted Parasites with a Hosts File, contains a host file for download and instructions for installation. Adding this list to the existing /etc/hosts will prevent ads from appearing by resolving their domain names to 127.0.0.1. Strategy 1. Start with the latest hosts file, and append it to the existing /etc/hosts.

2. Not all ad servers on the Internet are blocked, so when a new one appears, find its domain name and add it to /etc/hosts. Continue to do this for all domains to block, not just ads. 3. Save the hosts file for future use. Editing /etc/hosts Open /etc/hosts in a text editor. sudo gedit /etc/hosts Something like this will appear: 192.168.1.1 mysystem # Added by NetworkManager 127.0.0.1 localhost.localdomain localhost ::1 mysystem localhost6.localdomain6 localhost6 127.0.1.1 mysystem # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Keep these lines, and do not edit them since they are needed for the system. Append any blocked domain names to the end of the file. Other than the default lines shown above, /etc/hosts will be empty. Each blocked domain name exists on its own line with the IP address (0.0.0.0 or 127.0.0.1) first, and the domain name second and separated by a whitespace. Examples: 0.0.0.0 www.nastyadserver.ads 0.0.0.0 fr.weliketospyonyou.nowhere 0.0.0.0 m.t.whatisthis.huh 0.0.0.0 ad.server.notagain

Before adding custom entries, begin by opening the downloaded hosts file in a text editor. By default, domain names are mapped to 127.0.0.1. The null IP address 0.0.0.0 usually works better to avoid conflicts with any local servers that might be running on 127.0.0.1, so replace all 127.0.0.1 with 0.0.0.0 in the downloaded hosts file. Now, copy and paste the entire file into /etc/hosts after the system lines. There is no need to reboot the system for the changes to take effect, but any open programs, such as web browsers, must be restarted. What Happens? Ads mapped to 0.0.0.0 will not appear. Other times, ad frames will display information similar to the Connection closed by remote server message seen in Opera. A Blocked Site is Still Getting Through? Why? There are two possible causes.

1. The /etc/hosts file might not be registered with open programs. Close all instances of the web browser. Check the System Monitor since there might be zombie processes of Firefox, for example, that are still running. 2. Check to make sure that the domain name is exact. If you wish to block uglyadsite.where, make sure it is spelled exactly as uglyadsite.where. Blocking is performed at the domain name level, so attempting to block a certain page will not work. It could be that a different domain name or even a direct IP address is used for the connection. Some ads are sneaky, so double check. An entry in /etc/hosts might exist for y.lottaspam.fr.m, but the ad could be connecting directly to its server using an IP address. In this case, /etc/hosts will not help. System-wide Use The best part about /etc/hosts is that all programs requiring a DNS lookup check it by default. Whether it is an email client, web browser, media player, or whatever, any changes made to /etc/hosts affect them all. This saves time. Instead of editing each program one by one, a single entry added to /etc/hosts will be used by all programs. Anti-Anti-Ad-Block Some sites like to detect the Ad-Block addon for Firefox and deny access if Ad-Block is detected and enabled. Ad-Block is an excellent companion, but no site can detect and block the /etc/hosts file, so it should block access to known ad servers whether or not Ad-Block is installed. Using with Windows Another handy fact about /etc/hosts is that it is cross-platform compatible with the Windows hosts file. Windows performs DNS lookups in much the same way as Linux (local first, then remote). Any edits made on a Linux system are valid on a Windows system by copying the /etc/hosts file into Windows.

Different versions of Windows place the hosts file in different paths and add certain protections to the file, so consult the instructions for installation on the Blocking Unwanted Parasites with a Hosts File web page. Conclusion The /etc/hosts is effective in blocking connections to ad servers because it denies valid DNS lookups for specified domain names. More ad-blocking strategies exists, so /etc/hosts is only one link in a much larger chain rather than a one-size-fits-all solution, but its common use by programs makes it an effective starting point. Best of all, /etc/hosts is already present and editable without installing any browser plugins.