Block ads and malware with your host's file

We all know how annoying it can be to visit a website and be bombarded with ads, pop-ups, and other malicious software. It can be difficult to navigate around these types of websites and we often feel powerless to stop them. Fortunately, there is an effective way to block all of this unwanted content, using […]

Posted - January 14, 2023

Categories:

Connection Cybersecurity DNS How-To Malware Whitelist

We all know how annoying it can be to visit a website and be bombarded with ads, pop-ups, and other malicious software. It can be difficult to navigate around these types of websites and we often feel powerless to stop them. Fortunately, there is an effective way to block all of this unwanted content, using your computer’s host file. In this blog post, we’ll explore what the host's file is, how it works to protect you from unwanted ads and malware, and how you can use it to improve your online safety. So read on if you want to learn more about the power of your host's file!

What Is the Hosts File

The host's file is a local text file that maps hostnames to IP addresses. When a web browser or other application tries to connect to a hostname, it will first check the host's file to see if there is an entry for that hostname. If there is an entry, the browser will connect to the IP address specified in the host file instead of looking up the hostname in DNS. This can block ads and malware by mapping known ad and malware domains to a dummy IP address.

Use the Hosts File to Block Advertisements and Malware

Your host file is a local copy of a DNS file that tells your computer where to find websites. By editing your host's file, you can block ads and malware before they even reach your computer.

To edit your hosts' files, you will need a text editor like Notepad++ or Sublime Text. Open the host's file in your text editor and add the following lines at the bottom:

127.0.0.1 adserver.com
127.0.0.1 ads.yahoo.com
127.0.0.1 adservices.google.com
save and close the file."

Editing Your Hosts File

To edit your host's file, you'll need to open it in a text editor. The host file is usually located at C:\Windows\System32\drivers\etc\hosts. Once you have the file open, you can add entries to the bottom of the file in this format:

IP_address domain_name

For example, to block ads from doubleclick.net, you would add the following line to your hosts file:

127.0.0.1 doubleclick.net

You can add as many entries as you like, one per line. When you're finished, save the file and reboot your computer for the changes to take effect.

Edit the host's file on Windows

The host's file is a text file that contains a mapping of hostnames to IP addresses. The host file is used to resolve hostnames to IP addresses and is usually located in the C:\Windows\System32\drivers\etc folder.

To edit the host's file on Windows, you will need to open the file in a text editor such as Notepad. Once the file is open, you can add any desired mappings. For example, to block all ads from Google, you could add the following line to your host's file:

127.0.0.1 www.googleadservices.com

You can also use wildcards in your mappings. For example, the following mapping would block all ads served by Google:

127.0.0.1 *.googleadservices

How to further enhance online protection

There are a few things you can do to further enhance online protection when using a host's file. One is to keep your host's file up-to-date. An excellent way to do this is to subscribe to a service that provides updated host files, such as MVPS HOSTS or hosts.

Another way to improve online protection is by blocking additional ad and malware domains in your host file. Some of these domains may be Tracking Cookies, Phishing Sites, or Malware Domains. You can find lists of these domains online, such as the one maintained by the Malwaredomains Project.

Finally, you can use a tool like Hostsman to manage your host's file and make sure it stays up-to-date. Horsman can also block additional domains, as well as backup and restore your host's file.