Verify DNS and Web servers are running
Run these commands to verify that the required services are running:
sudo service dnsmasq status
sudo service lighttpd status
If either of the services are not running, you can start it like this:
sudo service <SERVICE_NAME> start
Verify config files
If either of the services fail to start, it is most likely a problem with the config file. The Pi-hole can actually survive without the Web server, but DNS is absolutely necessary. Verify your
/etc/dnsmasq.d/01-pihole.conf matches this (replacing any placeholder values).
You can also check the lighttpd config file for Debian or Fedora.
Configure devices to use the Pi-hole
If the services are running and ads are still not blocked, you should first verify that your device(s) are using the Pi-hole as their DNS server. If you are using Windows and are running Avast!, you may run into issues where even though the Pi-hole is set as your DNS server, Avast! decides what to use instead.
curl a regular domain and an ad domain
Before actually testing the Pi-hole on a Website, first verify it is working from the command line.
First, on your Raspberry Pi, run this command, which will allow you to watch queries happen in real-time:
sudo tail -f /var/log/pihole.log
From one of your devices configured to use the Pi-hole, run this command:
curl -I a-ads.com
this should return the header from the Pi-hole Web server, which contains a line like this:
HTTP/1.1 200 OK
X-Pi-hole: A black hole for Internet advertisements.
Last-Modified: Sat, 22 Oct 2016 03:03:40 GMT
Date: Mon, 31 Oct 2016 03:24:48 GMT
The line above should be returned when you curl any ad-serving domain that is on
/etc/pihole/gravity.list. If you see the
X-Pi-hole header, then it is working. You could use any domain on your list for this test, a-ads.com is just an easy one to remember.
Now, if you look at your log file, you should see an entry that your computer made a request for a-ads.com, which tells you name resolution is working and your Pi is responding to requests. This should also show up in the Web interface dashboard.
You can also verify that the admin Dashboard is working by running a similar command:
curl -I http://<PI-HOLE_IP_ADDRESS>/admin/index.php
this will return a different message stating that the dashboard is working and accessible.
HTTP/1.1 200 OK
X-Pi-hole: The Pi-hole Web interface is working!
Content-type: text/html; charset=UTF-8
Date: Mon, 31 Oct 2016 03:27:00 GMT
Test that ads are blocked on a real Website
Next, you may want to see if ads are actually blocked on a Website. Below are some of the pages I often use to verify that it is working:
- any Macworld article
- any OS X Daily article
Check Anti-Virus Settings
Some Anti-Virus programs such as Avast! have settings such as "Secure DNS" automatically enabled, which filters all DNS queries through their own servers instead of the ones you set. Source
Why are some ads still getting through?
- the domain the ads are coming from is not on the list
- the ad is hosted on the same site that you are visiting (it's semi-possible to block these, but needs quite a bit of work)