Network-wide ad blocker on a Raspberry Pi 2
Raspberry Pi OS Lite, Pi-hole, Tailscale, Linux
I turned an old Raspberry Pi 2 into a DNS server that blocks ads and trackers for my phone wherever I am, on a building network I don't control. Getting there meant solving four problems, in this order:
-
The Pi booted to a black screen
The board was running but showed no picture. I confirmed Linux was alive by toggling Caps Lock on a USB keyboard, traced the problem to the graphics driver handoff, and fixed it by disabling the KMS overlay in
config.txt. -
The apartment network isolates devices
My laptop and phone couldn't reach the Pi on the building Wi-Fi. Instead of a personal router the lease might not allow, I put the Pi and my devices on a Tailscale mesh network and routed DNS through the Pi's private address.
-
Pi-hole ignored requests from the VPN
Queries arrived on the Tailscale interface and were dropped. I changed Pi-hole's listening mode so it answers on every interface, which is safe because only my own devices can reach it.
-
The building blocks outside DNS servers
Lookups reached the Pi but never got answers. Testing with
digshowed queries to public resolvers timed out while the building's own resolver worked, so I pointed Pi-hole's upstream at the building's DNS.
Result: ad and tracker blocking on my phone at home, on campus and on cellular data, with a dashboard showing every domain my devices contact.