If you have children at home who routinely access the computer, you might be worried about them being exposed to adult materials and porn easily available and accessible all over the internet.
Let me share a neat trick on how to block porn and adult content in Ubuntu.
Blocking porn is extremely easy thanks to the wonderful OpenDNS. It is basically DNS blocking. Basically, you will replace your current DNS server with OpenDNS. OpenDNS has a database of adult websites all over the internet. So, whenever an adult website is tried to be accessed, the DNS server redirects to a warning page.
This is the least painful way of blocking adult content because you donβt need to bother about what websites are good or bad.
OpenDNS has free services for home users who want to block access to inappropriate websites on their computer (or router). There are two types of free service available with OpenDNS for content filtering:
- OpenDNS Home
- OpenDNS FamilyShield
If you are looking for easy configuration to block porn material, go for OpenDNS FamilyShield. You can choose to do the content filtering at two levels:
- On your computer
- On your router
If you do it on your router, porn, and other such material will be blocked for all the devices that connect to your home network. In this tutorial, we will see how to do it on your computer.
Block adult content with OpenDNS in Linux
OpenDNS works by changing your DNS to its own DNS server. And with this, it blocks a pre-defined (by OpenDNS community) set of websites which it terms as βharmfulβ.
Step 1: Open Network Settings
Open the Network Settings. To do this, search for Network Settings in Ubuntu Activities Overview.
Step 2: Select the Network of Choice
Select the type of network you use: Wired or Wireless and then click on the gear icon adjacent to it to edit the connection settings.
Step 3: Change the DNS Server
- Now in here, go to the IPv4 Settings tab.
- Change the Method to Automatic (DHCP) addresses only.
- Use these two DNS servers in the field DNS Severs: 208.67.222.123, 208.67.220.123
- Save it and reboot your computer.
Once rebooted, you can visit the site below to check if OpenDNS is working.
If everything is successful, then you will get a screen like the one in the screenshot below.
Possible troubleshoot:
If your settings get changed after each reboot, get it fixed via terminal:
sudo cp /etc/resolv.conf /etc/resolv.conf.auto
Now, find the correct dhclient.conf
file you can use by searching for it in the /etc
directory, using the find command.
sudo find /etc -name dhclient.conf
Once you find yours, edit it with Gedit using the command:
sudo gedit /etc/dhcp/dhclient.conf
Don't forget to change the location according to the output of the previous search.
Now, add the following line to the document before the require subnet-mask
command:
supersede domain-name-servers 208.67.222.123,208.67.220.123;
Save and exit. Now restart the network in Ubuntu:
sudo ifdown eth0 && sudo ifup eth0
You may be required to change eth0 to your own network deviceβs name if it uses a non-standard name.
Read here for more details and set it on your router. I hope you were able to block adult content as easily as you find the Wi-Fi access points in Ubuntu.
If you want to go to the next level, set up Pi Hole at router level and enjoy ad-free browsing with even better control.