Pi-hole is a DNS sinkhole designed to block ads at the network level by acting as your DNS server; it’s like using AdBlock for every device on your network. It’s especially useful for iOS and Android devices since Pi-hole can block ads in both the browser and apps.
Installation on my Ubuntu 16.04 box was dead simple:
1 |
curl -sSL https://install.pi-hole.net | bash |
After running it for almost a week, I accumulated the following stats below; it’s amazing how many requests were blocked since I’m already using uBlock in Chrome.
After rebooting the system Pi-hole was running on, I noticed the DNS resolution was broken because the dnsmasq service was not running:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
samfisher@Skullbox:~$ service dnsmasq status ● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled) Drop-In: /run/systemd/generator/dnsmasq.service.d └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf Active: failed (Result: exit-code) since Sun 2018-08-05 16:24:18 PDT; 19s ago Process: 864 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2) Process: 835 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS) Aug 05 16:24:18 Skullbox systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server... Aug 05 16:24:18 Skullbox dnsmasq[835]: dnsmasq: syntax check OK. Aug 05 16:24:18 Skullbox dnsmasq[864]: dnsmasq: unknown interface eno1 Aug 05 16:24:18 Skullbox systemd[1]: dnsmasq.service: Control process exited, code=exited status=2 Aug 05 16:24:18 Skullbox systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server. Aug 05 16:24:18 Skullbox systemd[1]: dnsmasq.service: Unit entered failed state. Aug 05 16:24:18 Skullbox systemd[1]: dnsmasq.service: Failed with result 'exit-code'. |
Apparently there is a bug in Ubuntu 16.04 with the dnsmasq service trying to start before network interface is up. Thanks to this, I was able to fix it by adding the highlighted lines below to the [Unit] section of /lib/systemd/system/dnsmasq.service:
1 2 3 4 5 6 7 |
sudo vi /lib/systemd/system/dnsmasq.service [Unit] Description=dnsmasq - A lightweight DHCP and caching DNS server Requires=network.target After=network-online.target Wants=network-online.target |