Home › Knowledgebase › KB-576

How to manage and block distracting websites using DNS filtering and Hosts files

Summary

This guide helps you troubleshoot and resolve: How to manage and block distracting websites using DNS filtering and Hosts files. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

Maintaining productivity in a home office or small business environment often requires limiting access to distracting websites. Depending on your technical skill and the level of control required, you can achieve this using DNS filtering for a network-wide approach or editing the local Hosts file for device-specific restrictions.

Quick Fix Steps

If you need a fast solution without modifying system files, we recommend using a filtered DNS service such as Cloudflare for Families or OpenDNS. This redirects your internet traffic through a server that automatically blocks known distracting or malicious domains.

  1. Change your network DNS settings to 1.1.1.3 and 1.0.0.3 (Cloudflare Family).
  2. Restart your web browser.
  3. Attempt to visit a restricted site to verify the block is active.

Detailed Instructions

Method 1: Using the Hosts File (Device Specific)

The Hosts file is a local text file that maps hostnames to IP addresses. By mapping a website to 127.0.0.1 (the local loopback address), the computer will effectively block the site.

On Windows 10 and 11

  1. Click the Start menu and type Notepad.
  2. Right-click on Notepad and select Run as administrator. This is critical; otherwise, you cannot save changes.
  3. In Notepad, go to File > Open.
  4. Navigate to the following path: C:\Windows\System32\drivers\etc
  5. Change the file type filter from Text Documents (*.txt) to All Files (*.*).
  6. Select the file named hosts and click Open.
  7. Scroll to the bottom of the document and add the websites you wish to block on new lines using this format:
    • 127.0.0.1 www.facebook.com
    • 127.0.0.1 facebook.com
  8. Go to File > Save and close the application.

On macOS

  1. Open Terminal (found in Applications > Utilities).
  2. Type the following command and press Enter: sudo nano /etc/hosts
  3. Enter your administrator password when prompted (characters will not appear as you type).
  4. Use the arrow keys to scroll to the bottom of the file.
  5. Add the sites to block using the same format as Windows: 127.0.0.1 www.instagram.com
  6. Press Control + O to write the changes, then Enter to confirm.
  7. Press Control + X to exit the editor.
  8. Flush your DNS cache by typing: sudo killall -HUP mDNSResponder
Editing the Hosts file can cause connectivity issues if incorrect entries are added. Ensure there are no typos in the IP address 127.0.0.1.

Method 2: DNS Filtering (Network Wide)

DNS filtering is more effective for organisations as it covers all devices connected to the router, including mobile phones and tablets.

  1. Log into your router's administration panel via your web browser.
  2. Locate the WAN or LAN settings section.
  3. Find the DNS Server settings (often set to Automatic or Get from ISP).
  4. Change the setting to Manual and enter the filtered DNS addresses provided by your chosen provider.
  5. Save the settings and reboot your router.
If you are using a managed firewall provided by 220 Internet Services, you may have access to a more advanced web filtering dashboard. Please Open a Ticket to request a review of your current filtering policies.

Troubleshooting

The website is still loading

Modern browsers often cache DNS records or use "DNS over HTTPS" (DoH), which bypasses local Hosts files and router settings.

I cannot save the Hosts file

This is almost always a permissions issue. Ensure you have launched your text editor as an administrator. On Windows, you must right-click the application icon to find the Run as administrator option.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket