How to Use Computer’s Hosts File to Block Malware and Ads?

How to Use Computer’s Hosts File to Block Malware and Ads

The Facebook-Cambridge Analytica controversy has shown that anyone can easily gather the data of other users and use this data for any cause without express consent. Consequently, it is essential to improve the online experience from the monitoring websites tricky pop-ups, and invasive ads. You can protect your data by editing the Hosts file.  

What is Host File?

User information is one of the most valuable assets on the internet, and either with or without your permission many companies are doing everything they can to get their paws on your information. We’ve seen over the recent months that research companies like Cambridge Analytica can collect user information from social networking sites and gather a lot of information regarding their hobbies and interests

Not only Cambridge Analytica, but even typical online services that you are using daily can collect your information by attracting you into the surveys. They make you click on advertisements and links that could infringe your confidentiality.

Although it may appear complicated, preventing your Computer from linking to such sites is very easy.

  • The host file is indeed a plain text which is used for mapping the domain names to the IP address. When a web site is entered into a browser, the computer inquires a phonebook or a Domain Name Server (DNS) to resolve the site name.
  • The host file will be loaded into memory at the bootup, and the operating system will request it before checking the URL on a Domain Name Server.
  • Because the Hosts file is queried before the computer connects with a domain name server, any URL entered in the browser will be redirected to the relevant address in the Hosts file.
  • This function could be used to enable other purposes, such as blocking harmful or malicious websites, blocking ad trackers, or even visiting sites with a shortcut.
  • The best aspect of blocking websites with the Hosts file is that the changes take place on the operating system, and consequently, it denies the use of pop-up blocker extensions and external ads.

What are the Advantages of Blocking Ads?

You may have been using some extensions for the adblocking, but the Host files of your computer can also block ads. The following are some of the advantages of Ad blocking.

  • Advertisers will be unable to monitor your activity online
  • Less possibility of having adware, malware, or even viruses.
  • Quicker loading times of the page
  • Cleaner websites

Why Should you Edit the Host Files?

1. Block ads and tracking websites

We promote the non-intrusive ads, but several ads may also increase the loading time of the site. Many sites often put tracking cookies on your computer to monitor your preferences of use and shopping habits. It’d be a very time-consuming process to manually collect all pop-up and ad links from the sites you visit and type the IPs in the Hosts file.

Besides blocking particular domains, advertisements, and other unnecessary sites, there are several other reasons for the Hosts file, like redirecting to some other site or giving a customized name for local pcs on the network. 

2. Block Access to a Website (Bann Adult sites for Children)

One of the main reasons to edit the Hosts file is blocking a specific website. This may be because you think the site is harmful, or you want to prevent children from unintentionally opening something negative on the internet. You can stop your employees from visiting banned sites in a professional environment.

It should be recalled that ‘ blocking ‘ here basically means redirecting domain query back to the local host.

Let’s assume that you want to restrict access to netflix.com from your PC. Just add netflix.com domain to host files with 127.0.0.1 and save it. You may also use this technique to prevent a particular ad server. Once you have found a domain that serves annoying ads, consider ‘annoyingads.com.’ For example, add that domain to the Hosts file with 127.0.0.1, and it will block all data on that server so that the advertisement will not appear.

3. Redirect to a different website

The Hosts file could also be used for redirecting to various sites. For example, you are allowed to redirect visitors from Facebook to Twitter and Google to Bing. Redirecting to some other website involves knowledge of the IP address of that website.

Open the command prompt window on your pc and type the ping “website name.” it will display the IP address of that website in Ping. If you want to redirect from Twitter to Facebook, so find the IP of Facebook from the ping command. This address is 157.240.16.35. You will have to make the appropriate entry in a new line in Host files. Now the domain name should be as twitter.com.

The host files should be saved now and access twitter.com from your browser. There will be an SSL error because Facebook has been using HTTPS protocol, and it requires name in the certificate of the site should match with the entered domain name.

If there is no matching, the browser couldn’t be able to access the website as a safety measure. But you should confirm that the redirect has taken place by pinging twitter.com, and now it is redirecting to the IP address of Facebook.

How to edit Host Files on Windows?

  1. Open the “Notepad” of your computer by “Run as administrator “
  2. Move to Windows C drive>Windows>Ssytem32>Drivers>etc.>Hosts
  3. Now enter the Domain name, or you can paste the list.
  4. Just Save all the changes, and you’re done.

How to edit Host Files on Mac OS?

  1. Go to “Applications” and open “Utilities.”
  2. Click on “Terminal” to start
  3. Type “Sudo nano /private/etc/hosts”
  4. You will have to enter the password
  5. Enter the domain name, or you can paste the list
  6. Save all the changes and click on “y” for confirmation.  

You may also like:

How to Open a Computer without Password?

How to find your port number?

What is Ad Blocker? How do they Protect your Online Privacy?

How to get rid of Retargeting Ads: Stop them from Following You over the Internet

What a VPN Does to Protect Your Computer

How to tell if my computer is hacked?

Top 6 VPN Scams You Should be Wary of

How to Setup RitaVPN on your Windows PC

RitaVPN is one of the fast and secure VPN services which ensures the high-speed internet connection. It gives you an extra wall of security by encrypting the data, and no one can trace your online searches. Download RitaVPN and unblock websites with just a few clicks.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like