If you are looking for a network-wide ad blocker, Pi-Hole is the product you are looking for. Pi-Hole blocks advertisement at the DNS level; therefore, all your clients who use your Pi-Hole as their DNS
To install Pi-Hole, you would just copy and paste this command
curl -sSL https://install.pi-hole.net | bash
Instead of using the IP address to access our internal services, we can utilize Pi-Hole to resolve whatever name we assigned to each service. Let’s say we have a
Service | IP Address | Port | Hostname | URL |
Jellyfin | 10.0.7.10 | 8096 | jellyfin | http://jellyfin:8096 |
Piwigo | 10.0.7.12 | 82 | piwigo | http://piwigo:80 |
We just need to add some lines to the /etc/hosts
file and restart Pi-Hole service. To do so, vim /etc/hosts
Note: I was running this on Debian 9 LXC and I was using the root account. If you are not using the root account, you would need to add sudo
at the beginning.
root@pihole:~# vim /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters # --- BEGIN PVE --- 192.168.20.10 pihole.1.1.1.1 pihole # --- END PVE --- # Anything above this line are part of your Pi-Hole installation # Internal domain 192.168.7.10 jellyfin 192.168.7.12 piwigo
Once you are done, save the changes and restart Pi-Hole DNS.
pihole restartdns
That is it. You can add more hostnames or FQDN whichever you preferred to the /etc/hosts file. Just remember that whenever you edit the /etc/hosts file, you would need to restart the DNS service.
Cheers!