How to block porn sites and offensive internet content on a PC

This tutorial explains how to block access to adult sites on a PC. We block sites with dangerous or offensive content such as sites of a pornographic nature and those broadcasting shocking or repugnant images or videos. Clearly, any content inappropriate for children and sensitive people.

You will also be able to block gambling sites, social networks (Facebook, Twitter and others) as well as fakenews.

This article is primarily intended for parents and schools who want to protect their children and students from offensive content on the Internet.

Important : this tutorial allows you to block adult sites on a single computer (laptop or desktop computer). To cover your entire home, you will have to repeat these operations on all the other PCs in your household.

Prerequisites

  • A PC running on Windows, Linux or macOS.
  • On this PC, you must have an administrator account. We will indeed modify system parameters which require some privileges.
  • Make sure the person you want to prevent access to sensitive sites has a standard user account (not an administrator). Otherwise, it can easily restore the parameters you are about to modify.

Method 1: with the hosts file

How it works ?

The hosts file is a file used by the operating system when accessing a network (such as the Internet).

Think of it as a directory: we can for example write in it that the domain name computer-tricks.com is accessible at the IP address 199.16.128.7.

This hosts file, we will use it for our account : by indicating for example that the site which has the domain name pornoxxx.com is located at the IP address 0.0.0.0, access to this site cannot be available !

Simple and powerful, but it would be too long and tedious!

Fortunately, we have some prefilled hosts files with the addresses of all malicious sites identified.

Several hosts files are available, depending on what you want to block :

  • Malware : collects hosts files from recognized sources (adaway.org, mvps.org, malwaredomainlist.com, someonewhocares.org) to block as much malware as possible.
  • Fakenews.
  • Gambling.
  • Pornography.
  • Social networks.
FILES HOSTSNB. DOMAINESLINK
adwares + malwares40 908link
fakenews41 576link
Gambling43 176link
porno52 747link
social43 383link
fakenews + Gambling43 844link
fakenews + porno53 415link
fakenews + social44 051link
Gambling + porno55 015link
Gambling + social45 651link
porno + social55 221link
fakenews + Gambling + porno55 683link
fakenews + Gambling + social46 319link
fakenews + porno + social55 889link
Gambling + porno + social57 489link
fakenews + Gambling + porno + social58 157link

Let’s see how to import one of these hosts files on our PC to block adult sites (example here with a Windows PC)!

Block adult sites using host files

  1. Open one of hosts files by clicking on the link of the one that interests you (see the table above).
  2. Select the entire contents of the file with Ctrl + A then copy it with Ctrl + C.
  3. Open the Windows hosts file as administrator
    • Open the Run command.
    • Enter the following command:
      notepad C:\Windows\System32\drivers\etc\hosts
    • Press CTRL + SHIFT + Enter.
  4. The hosts file opens in Notepad.
  5. Paste the contents of the hosts file at the end of the Windows hosts file with Ctrl + V.
  6. Save the Windows hosts file with Ctrl + S.
  7. Clear the Windows DNS cache: 
    • Open a command prompt as an administrator.
    • Enter the following command: ipconfig /flushdns
  8. Now, adult sites are now blocked ! Try to access one of them to see: connection to the site is no longer possible.

Congratulations ! You have blocked all adult sites on your PC using the hosts file.

Method 2: Changing DNS Servers

How it works ?

When you surf the Internet, you unknowingly use Domain Name Servers (DNS) which convert the domain names of websites into IP addresses (usable by computers).

When you type a domain name in the browser’s address bar, your PC contacts the defined DNS servers to ask them which IP address it can find the domain you want to access.

The DNS servers you are currently using are likely provided by your Internet Service Provider (ISP).

It is possible to change the DNS by modifying the parameters of your router, your Internet box (if the option is available) or your computer.

The hosts files on your computer and the DNS servers act similarly, like a directory that associates a domain name with an IP address.

The DNS servers are consulted after the hosts file on the computer. In other words, your PC first queries the hosts files and then the DNS servers (if there is no entry in the hosts file) to find the IP address of a domain name.

How can DNS servers help me block adult sites ?

It’s simple : some companies offer free DNS servers suitable for families (familly friendly) which block sites with explicit content such as X sites.

Here is a list of 4 DNS servers that filter sensitive sites:

DNSIPV4 ADDRESSIPV6 ADDRESS
OpenDNS Family Shield
– Block adult content
208.67.222.123
208.67.220.123
Yandex Family
– Block adult content
77.88.8.7
77.88.8.3
Neustar Family Secure
– Blocks malware
– Blocks gambling, pornography, violence and hate/discrimination
156.154.70.3
156.154.71.3
2610:a1:1018::3
2610:a1:1019::3
CleanBrowsing Family Filter
– Blocks malware
– Block adult content
– Block proxy and VPN domains used to bypass filters
185.228.168.168
185.228.169.168
2a0d:2a00:1::
2a0d:2a00:2::

According to hackernoon.com tests, CleanBrowsing Family Filter is the DNS that most effectively blocks adult content.

Let’s see how to configure it on your PC (example with Windows)!

Block adult sites using DNS servers

  1. Enter ncpa.cpl in the Run command.
  2. Right click on the network device that receives the Internet connection and click on Properties.
  3. In the Network management tab, select from the list Internet Protocol TCP/IPv4then click on the Properties button.
  4. By default, DNS are obtained automatically from your router or Internet box. Select the Use following DNS server addresses check box and then paste the addresses of the DNS servers of CleanBrowsing Family Filter (or another).
  5. Check the Validate settings when exiting box and click OK.
  6. Do the same with IPv6 addresses (if available).
  7. Now, adult sites are blocked ! Try to access one of them to see: connection to the site is no longer possible.

Congratulations ! You have blocked all adult sites on your PC by modifying the DNS servers in the operating system.

Conclusion

The blocking of sites with shocking content via the hosts file or the DNS servers that we have just seen is certainly effective, it has a defect : a single PC is protected!

In fact, the other members of your family surely use other devices to connect to the Internet such as a tablet or a smartphone, which are not protected and can access all of these adult sites.

You must therefore edit the hosts file and the DNS servers on all the other devices in your household (if possible) or install parental control software.

Even better : you can block sensitive sites directly on your router or Internet box. A tutorial will come soon to explain how to do it.