Whitelist Google Ads with Pi-hole v5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

2020

Whitelist Google Ads for some clients with Pi-hole v5.0

https://discourse.pi-hole.net/u/jpgpi250
© 2015 .. 2020 Jacob Salmela
20-5-2020
1. About this manual. .......................................................................................................................... 1
2. Goal ................................................................................................................................................. 1
3. Manual Configuration...................................................................................................................... 1
4. Scripted Configuration..................................................................................................................... 4
5. Change Log ...................................................................................................................................... 4

1. About this manual.


Using this guide will allow you to whitelist Google ads for some devices, this to avoid conflict
and keep the peace at home, using pi-hole v5.0.

If you are reading this document, using Adobe Reader, you may click on a hyperlink to
content in this document. Use the combination <Alt> <left arrow> to return to the previous
location.

"Back" and "Forward" buttons can also be added to the toolbar. If you right-click on the tool
bar, under "Page Navigation", they are referred to as "Previous View" and "Next View".

This document is hosted on GitHub, you can open the document (pdf), using this link.

2. Goal
Browsers, using the google search engine, will often show ad links, as the first results. Most
pi-hole setups use ad lists that will make these links inaccessible (blocked), leading to
unhappy wags, who often wish to see these ads. The goal of this manual is to:

- Allow the pi-hole administrator to make whitelist exceptions for certain devices (allow
access to google ads from the google search results).
- Provide an easier way to setup the configuration, by providing a script that will require
the administrator to perform only a few steps to whitelist google ads for a device.

3. Manual Configuration

Some of the required steps can be performed, by executing the script (see here).

1. Create the whitelist entries (menu Whitelist). The type should be ‘Exact whitelist’ don’t
check the wildcard checkbox).

The following whitelist entries need to be created to allow google search ad links to work
(list suggested here):

www.googleadservices.com
dartsearch.net
www.googletagmanager.com
www.googletagservices.com
ad.doubleclick.net
clickserve.dartsearch.net
The result should look like this:

2. Create a new group ‘googleads’ (menu Group Management / Groups).

The result should look like this:

3. Assign the whitelisted domains to the new group (menu Group Management / Domains)

The result should look like this:

The result of editing the group assignment (before clicking ‘Apply’) should look like this:

4. Create the client device (menu Group Management / Clients).


You can read more about clients in my pi-hole manual, section 17.2.

5. Add the desired device(s) (the client from the previous subsection) to the ‘googleads’ group.

I specifically used a configuration with multiple groups to show the possible results:

- Member of ‘The default group’ and the ‘googleads’ group. The client will be subject to
the default assignments, google ads will be whitelisted:

Result:

- Member of All groups (reference my pi-hole manual, section 18, a ‘whitelist example’).
The client will be subject to default assignments, android notifications will be allowed,
and, google ads will be whitelisted.

Result:

6. Activate changes.

- Ensure pi-hole (FTL) reads the changes, execute the following command:

pihole restartdns reload-lists

- Clear the windows cache (the wag device)

Ipconfig /flushdns
4. Scripted Configuration.

In order to make life easier, I’ve included a script that automatically makes the necessary
changes, steps 1 to 3 (create whitelist entries, create group, assign whitelist entries to
group).

It is impossible to assign your clients to the group, the script doesn’t know the specifications
of your (wags) device(s), these steps need to be performed manually, luckily, that part is the
easiest. Execute steps 4, 5 and 6 (create client, assign client to group and activate the
changes) manually, when using this script, to achieve google ads whitelisting.

WARNING: carefully read the comment in the script before executing it!

Click on the icon to view the script in a browser. Copy the content and make the
script executable (sudo chmod +x /home/pi/googleads.sh). You can also use
wget (click on Basic usage) to copy the script directly. Execute the script with
‘sudo’!

5. Change Log
17-05-2020

- Version 1 (draft). Report issues here.

You might also like