This one is for those of you who have noticed that your Chromecast devices (and I hear many Android phones too) do a connectivity check to http://connectivitycheck.gstatic.com every minute or so.
When an internet connection goes down the Chromecast tries hits this domain tens of thousands of times, making a right mess of the Pi-Hole graphs. I’ve also decided there’s no good reason why google needs to be able to count my device pings… so I engineered a little workaround. Call it an abundance of caution.
First, set up connectivitycheck.gstatic.com as a virtual host on a local web server. I used Apache2 on another machine (I already run a bunch of local sites there) but I’m sure Lighttpd on the Pi-Hole would be great too. (You’ll need to search for instructions for how to do this for your particular favourite web server.)
In a subfolder entitled /generate_204 (Ie, served at http://connectivitycheck.gstatic.com/generate_204) simply place an index.php file containing just the following:
<?php header("HTTP/1.0 204 No Content"); ?>
And then edit /etc/hosts on your Pi-Hole to include the following line:
10.0.0.1 connectivitycheck.gstatic.com #Replace 10.0.0.1 with the IP address of the web server
And restart the Pi-Hole DNS server, either via the web interface or the terminal with
And from now on Google gets to forget about your Android devices, plus you won’t see those annoying spikes when/if your connection goes down.