I got this question from a user on the Youtube community asking how to force Google Safe Search for their network.
SafeSearch is a feature in Google Search and Google Images that acts as an automated filter of pornography and potentially offensive and inappropriate content. On November 11, 2009, Google introduced the ability for users with Google Accounts to lock on the SafeSearch level in Google’s web and image searches.
There are multiple ways to implement SafeSearch enforcement, and we will address the two easiest method:
Method 1: Using Windows DNS hosts file
Follow these steps to force Google SafeSearch on Windows machines:
- In Windows, click the Windows key and type
Notepad
. - Right click on Notepad and choose
Run as Administrator
. - Click
Yes
when Windows asks if you want this program to make changes. - In Notepad, open your hosts file. In most Windows installations, this is located at:
C:\Windows\System32\drivers\etc\hosts
. - Click the Windows key, type
cmd
, and hit enter. This will open Command Prompt. - Enter the command
ping forcesafesearch.google.com
and note the IP address. The IP address will look something like:216.239.38.120
. - Create an entry at the end of hosts file with the IP address you obtained. For example:
216.239.38.120 www.google.com #forcesafesearch
. - Save the hosts file.
To confirm SafeSearch is on, open Google.com and check that SafeSearch is on by default and can’t be turned off.
Method 2: Using Pi-Hole DNS server
If you are running Pi-Hole server on Windows or Linux, you can follow these steps to enforce Google SafeSearch using Local DNS server, the benefit of this method that all client on your network will benefit from this enforcement, whereas method 1 must be applied to Windows clients one by one, no solution for mobile clients either.
- Using Windows CMD or Linux Terminal, enter the command
ping forcesafesearch.google.com
and note the IP address. The IP address will look something like:216.239.38.120
. - Login to your Pi-Hole server using the Web UI (GUI).
- Go to Local DNS from menu on the left -> DNS Records.
- Create an entry: Domain
google.com
and IP address216.239.38.120
. - You may need to wait for DNS cache (Local, Browser or Pi-Hole itself) to expire in order for you to see the effect.