Discussion - Pi-Hole Integration? (Local-Server Only) | PlexGuide.com

Discussion Pi-Hole Integration? (Local-Server Only)

  • Stop using Chrome! Download the Brave Browser via >>> [Brave.com]
    It's a forked version of Chrome with native ad-blockers and Google's spyware stripped out! Download for Mac, Windows, Android, and Linux!
Welcome to the PlexGuide.com
Serving the Community since 2016!
Register Now

ryanjohnson

Citizen
Original poster
Sep 28, 2018
9
8
Pi-Hole was originally engineered to be run on a raspberry pi and act as a DNS server capable of filtering unwanted ads across and entire network. I've bene using it for years but upon getting PlexGuide going I sought to take advantage of the pi-hole docker container. I've been running pi-hole on my local Ubuntu 18.04 LTS server for several weeks and have encountered no issues, other than an issue with Docker being able to properly route IPv6. Below are the steps I've taken to add Pi_hole to my server and work flawlessly with other PG apps.

Step 1: Disable Ubuntu's DNS resolver
Code:
sudo systemctl disable systemd-resolved.service

sudo systemctl stop systemd-resolved.service
Step 2: Open network manager configuration using the following command for editing
Code:
sudo nano /etc/NetworkManager/NetworkManager.conf
Add dns=default under [main]
Code:
[main]
plugins=ifupdown,keyfile
dns=default
Step 3: Rename resolve.conf and restart network manager
Code:
sudo mv /etc/resolv.conf /etc/resolv.conf.bak

sudo service network-manager restart
Step 4 (optional): Prep Pi-Hole for IPv6 and perpetual logging
Code:
sudo mkdir /opt/appdata/pihole

sudo touch /opt/appdata/pihole/pihole.log

Run this command to find your host machine's IPv6 address:
Code:
(ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')
Step 5: Run Pi-Hole with traefik support
A * indicates a user-specific field
Code:
sudo docker run -d \
--name pihole \
--restart=unless-stopped \
-p 53:53/tcp \
-p 53:53/udp \
-p 8182:80 \
-p 8183:443 \
-v /opt/appdata/pihole/pihole:/etc/pihole \
-v /opt/appdata/pihole/pihole.log:/var/log/pihole.log \
-v /opt/appdata/pihole/dnsmasq.d:/etc/dnsmasq.d \
*-e ServerIP=Host IP \
*-e ServerIPv6=Your IPv6 Address \
-e PROXY_LOCATION=pihole \
*-e VIRTUAL_HOST=pihole.yourdomain.com \
-e VIRTUAL_PORT=80 \
*-e TZ=YourTimeZone \
*-e WEBPASSWORD=UserDefinedPassword \
-e PUID=1000 \
-e PGID=1000 \
-l "traefik.enable=true" \
-l "traefik.backend=hole" \
-l "traefik.port=80" \
*-l "traefik.frontend.rule=Host:pihole.yourdomain.com,yourdomain.com" \
-l "traefik.frontend.priority=1" \
-l traefik.frontend.headers.SSLRedirect=true \
-l traefik.frontend.headers.STSSeconds=315360000 \
-l traefik.frontend.headers.browserXSSFilter=true \
-l traefik.frontend.headers.contentTypeNosniff=true \
-l traefik.frontend.headers.forceSTSHeader=true \
*-l traefik.frontend.headers.SSLHost=yourdomain.com \
-l traefik.frontend.headers.STSIncludeSubdomains=true \
-l traefik.frontend.headers.STSPreload=true \
-l traefik.frontend.headers.frameDeny=true \
pihole/pihole:latest


Final Remarks:
This is what's worked for my specific set up so it might not work for everyone. There is still the matter of setting your specific router to use your server as a DNS server. I currently use Google's DNS servers for my IPv4, however as I mentioned I believe Docker has limited functionality with IPv6 for containers.
Another note is that Pi-Hole has to run as the top level domain app for traefik. I believe this is due to both Pi-Hole and traefik sharing port 80.
I am also running traefik on the host network inside docker in order to provide support to containers not on the plexguide network. If anyone knows of a way to allow traefik access to host network containers without being on the host network itself I would appreciate knowing how.

I understand this is probably a stretch to implement as it goes beyond the requirements of most pg apps, however for those wanting to implement this into their systems I highly recommend it.
 
Last edited:
  • Like
Reactions: 3 users

Admin9705

Administrator
Project Manager
Donor
Jan 17, 2018
5,156
2,112
Pi-Hole was originally engineered to be run on a raspberry pi and act as a DNS server capable of filtering unwanted ads across and entire network. I've bene using it for years but upon getting PlexGuide going I sought to take advantage of the pi-hole docker container. I've been running pi-hole on my local Ubuntu 18.04 LTS server for several weeks and have encountered no issues, other than an issue with Docker being able to properly route IPv6. Below are the steps I've taken to add Pi_hole to my server and work flawlessly with other PG apps.

Step 1: Disable Ubuntu's DNS resolver

Code:
sudo systemctl disable systemd-resolved.service

sudo systemctl stop systemd-resolved.service
Step 2: Open network manager configuration using the following command for editing

Code:
sudo nano /etc/NetworkManager/NetworkManager.conf
Add dns=default under [main]
Code:
[main]
plugins=ifupdown,keyfile
dns=default
Step 3: Rename resolve.conf and restart network manager

Code:
sudo mv /etc/resolv.conf /etc/resolv.conf.bak

sudo service network-manager restart
Step 4 (optional): Prep Pi-Hole for IPv6 and perpetual logging

Code:
sudo mkdir /opt/appdata/pihole

sudo touch /opt/appdata/pihole/pihole.log

Run this command to find your host machine's IPv6 address: (ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')

Step 5: Run Pi-Hole with traefik support
Code:
sudo docker run -d \
--name pihole \
--restart=unless-stopped \
-p 53:53/tcp \
-p 53:53/udp \
-p 8182:80 \
-p 8183:443 \
-v /opt/appdata/pihole/pihole:/etc/pihole \
-v /opt/appdata/pihole/pihole.log:/var/log/pihole.log \
-v /opt/appdata/pihole/dnsmasq.d:/etc/dnsmasq.d \
-e ServerIP=Host IP \
-e ServerIPv6=Your IPv6 Address
-e PROXY_LOCATION=pihole \
-e VIRTUAL_HOST=pihole.yourdomain.com \
-e VIRTUAL_PORT=80 \
-e TZ=YourTimeZone \
-e WEBPASSWORD=UserDefinedPassword \
-e PUID=1000 \
-e PGID=1000 \
-l "traefik.enable=true" \
-l "traefik.backend=hole" \
-l "traefik.port=80" \
-l "traefik.frontend.rule=Host:pihole.yourdomain.com,yourdomain.com" \
-l "traefik.frontend.priority=1" \
-l traefik.frontend.headers.SSLRedirect=true \
-l traefik.frontend.headers.STSSeconds=315360000 \
-l traefik.frontend.headers.browserXSSFilter=true \
-l traefik.frontend.headers.contentTypeNosniff=true \
-l traefik.frontend.headers.forceSTSHeader=true \
-l traefik.frontend.headers.SSLHost=yourdomain.com \
-l traefik.frontend.headers.STSIncludeSubdomains=true \
-l traefik.frontend.headers.STSPreload=true \
-l traefik.frontend.headers.frameDeny=true \
pihole/pihole:latest


Final Remarks:
This is what's worked for my specific set up so it might not work for everyone. There is still the matter of setting your specific router to use your server as a DNS server. I currently use Google's DNS servers for my IPv4, however as I mentioned I believe Docker has limited functionality with IPv6 for containers.
Another note is that Pi-Hole has to run as the top level domain app for traefik. I believe this is due to both Pi-Hole and traefik sharing port 80.
I am also running traefik on the host network inside docker in order to provide support to containers not on the plexguide network. If anyone knows of a way to allow traefik access to host network containers without being on the host network itself I would appreciate knowing how.

I understand this is probably a stretch to implement as it goes beyond the requirements of most pg apps, however for those wanting to implement this into their systems I highly recommend it.
it's a good post. with some discussion, there might a good solution. thanks for the share! there is a custom container template now that people can add.
 

ryanjohnson

Citizen
Original poster
Sep 28, 2018
9
8
how is this useful for a PG setup?
Great question! I found it useful for me in minimizing unwanted ads across my home network on all devices. While none of the pg apps available host ads of their own, I feel like this would benefit people in other ways and integrate fairly well into their current setups. I only posted it here because I found a way to make it work for my setup and if in the future anyone else wanted to find clear instructions on how to get pi-hole working with their system I figured I may as well detail it here.

TL;DR, I've used pi-hole for years and wanted to add it to my server instead of using a raspberry pi, and found an easy way to integrate it with plexguide.
 
  • Like
Reactions: 1 user

hooper

Governer
Staff
Donor
Aug 1, 2018
310
119
I had used a pi-hole for some time (a couple of releases old in fairness) and found it to be problematic with some of my devices. I might need to give it another go.

A feature I would like to see is configurable content filtering. I'd love to exclude all kardashian, kanye, cardi b, nikki minaj, etc. content from my network.
 

timekills

VIP
Staff
Donor
Sep 12, 2018
367
192
I think the question about its usefulness in PG is because the majority of PG users aren't deploying on local servers.
Also - it's more just using Docker since it's installed as part of PG., rather than any association with a media system.

But it's still appreciated! I had used Docker before messing with PlexGuide, but not nearly to the extent of so many applications and very limited editing. I'm sure many are similar, so the only system they have that has Docker installed is very likely a PG setup.
 

captngimpy

Experienced+
Staff
Mar 14, 2018
112
32
I have been running pihole on a vps off site for a while now. Works great not only for my home network but also others that I have setup to use it. It's actually the only reason I am keeping 1 of my vps's. I was unaware there was a docker (why wouldn't there be one there is a docker for everything) I may move it over to my Plex host and get rid of my vps's
 
  • Like
Reactions: 1 users

timekills

VIP
Staff
Donor
Sep 12, 2018
367
192
I have been running pihole on a vps off site for a while now. Works great not only for my home network but also others that I have setup to use it. It's actually the only reason I am keeping 1 of my vps's. I was unaware there was a docker (why wouldn't there be one there is a docker for everything) I may move it over to my Plex host and get rid of my vps's
I missed the part in your OP reference setting your home router to use the remote (VPS) as DNS. That makes this much more interesting. Nice work.
 

CyborgPirate

Experienced
Aug 22, 2018
96
33
You can use open VPN or wire guard to keep it from being public. There are plenty of tutorials for doing this with ovpn. Not so many with wire guard yet as it's relatively new.
 

Recommend NewsGroups

      Up To a 58% Discount!

Trending