Skip to main content

Pi-hole on Raspberry Pi is a great way to block ads and improve your privacy while using this popular single-board computer. If you are looking for a way to get rid of ads and improve your privacy at the same time, then you should definitely consider using Pi-hole on Raspberry Pi. Pi-hole is a free and open-source ad blocker(and so much more) that can run on various devices, including the Raspberry Pi.

One of the great things about Pi-hole is that it supports IPv6, which means that you can use it to block ads on IPv6-enabled devices. This is especially useful if you have a lot of devices that are connected to the internet via IPv6.

To use Pi-hole with IPv6, you will need to configure your router to forward traffic from your IPv6 address range to the Pi-hole server. You can find more information about how to do this in the Pi-hole documentation.

You will need:

  • Raspberry Pi 3 Model B or later.
  • A microSD card with at least 8GB of storage.
  • A compatible network router.
  • An internet connection.
  • A USB keyboard and mouse (optional).
  • A monitor with an HDMI input (optional).

See tutorial on how to install Pi-hole on Raspberry Pi.

Installing Pi-hole on Raspberry Pi

Pi-hole is very simple to set up, especially with the auto install script.

url -sSL https://install.pi-hole.net | bash

Following the steps, you should have Pi-hole running out of the box. You must configure your router to send the IP address of your Pi-hole server as your local DNS.

If ads are still showing up:

Use scutil to ensure that you are not interfering with DHCP/DNS discovery:

scutil --dns

resolver #1
  search domain[0] : lan
  nameserver[0] : 2404:201:xxxx:xxxx:xxx:xxxx:4207:3091
  nameserver[1] : fe80::a206:60ff:fe43:3005%en0
  nameserver[2] : 192.128.2.38
  if_index : 6 (en0)
  flags    : Scoped, Request A records, Request AAAA records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

IPv4 appeared to be operational. My pi-hole server’s IP address is 192.128.2.38.

The IPv6 address, on the other hand, did not belong to pi-hole. The router advertised DNS and the default ISP setting was to use stateless IPv6 configuration. It was utilizing the ISP’s upstream DNS server.

Make the following changes to correct this:

IPv6 on pi-hole

Obtain your IPv6 address for the pi-hole

ip addr show

Turn on IPv6 support on pi-hole.

Set the IPV6_ADDRESS add /etc/pihole/setupVars.conf

This should have been done during pi-hole installation, but if it wasn’t, you can manually set it up using the address above.

IPV4_ADDRESS=192.128.2.38
IPV6_ADDRESS=2404:xxx:xxxx:xxxx::50/64

Restart FTL:

systemctl restart pihole-FTL

Enable AAAA query analysis for Pi-hole

Pi-hole will only analyze A queries by default, so we must add support for AAAA searches.

DBINTERVAL=60
MAXDBDAYS=7
AAAA_QUERY_ANALYSIS=yes

PRIVACYLEVEL=0

Finally, perform a diagnosis on Pi-hole to ensure that everything is in order.

pihole -d

Conclusion

Pi-hole is a great way to block ads and improve your privacy at the same time. It is easy to install and configure, and it supports IPv6.