> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Quickly and Easily Block Adult Content on Ubuntu and Other Linux
- URL: https://itsfoss.com/block-adult-content-linux/
- Published: 2013-01-21T23:00:30.000Z
- Updated: 2024-03-13T10:10:16.000Z
- Description: Change the DNS to OpenDNS's family shield and it will automatically blocks a huge number of adult websites.
- Author: Abhishek Prakash
- Tags: Tips 💡

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**](https://itsfoss.com/tag/ubuntu/).

Blocking porn is extremely easy thanks to the wonderful [OpenDNS](http://www.opendns.com/?ref=itsfoss.com). It is basically [DNS blocking](http://blogjunkie.net/2011/06/get-around-dns-block-filter?ref=itsfoss.com). 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

![Various openDNS Plans listed on the official website](https://itsfoss.com/content/images/2024/03/openDNS-Plans.png)

OpenDNS Options available

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](https://itsfoss.com/gnome-search/).

![Select Network Settings from Ubuntu Activities Overview](https://itsfoss.com/content/images/2024/03/select-network-settings.png)

Select Network from Dash

### 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.

![Click on the gear icon a adjacent to the network you want to configure](https://itsfoss.com/content/images/2024/03/select-settings-of-the-required-network.png)

Select Settings for the Network

### 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.

![Set the given servers to the DNS field on IPV4 and click on Apply](https://itsfoss.com/content/images/2024/03/set-server-numbers-on-ipv4-settings.png)

Set DNS Servers

Once rebooted, you can visit the site below to check if OpenDNS is working.

[Check if OpenDNS is Working](https://welcome.opendns.com/?ref=itsfoss.com)

If everything is successful, then you will get a screen like the one in the screenshot below.

![Successfully set up OpenDNS. This is shown when the link is visited.](https://itsfoss.com/content/images/2024/03/you-are-using-opendns.png)

OpenDNS Success

### 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](https://linuxhandbook.com/find-command-examples/?ref=itsfoss.com).

```
sudo find /etc -name dhclient.conf

```

![Search for the correct dhclient config file on the /etc location using the find command](https://itsfoss.com/content/images/2024/03/searching-dhclient-conf-file.png)

Search dhclient config file

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](https://itsfoss.com/restart-network-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](https://www.opendns.com/setupguide/?ref=itsfoss.com#familyshield) 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](https://itsfoss.com/show-security-of-wireless-access-points-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.

[How to Set Up Pi-hole to Get an Ad-free LifePi-hole is a DNS-based advertisement blocker. Unlike a Chrome or Firefox extension, a Pi-hole can block ads even on your TV! So let’s see how to install and take advantage of this amazing tool! What is Pi-hole? Pi-hole is a DNS Server. It blocks advertisement serving domains. Set it![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSPratham Patel![](https://itsfoss.com/content/images/wordpress/2022/11/install-pi-hole.png)](https://itsfoss.com/setup-pi-hole/)