Network

Pi-hole on Multiple Interfaces

Pi-hole on Multiple Interfaces
In: Network, General

In this short post, let's look at an example of how to configure Pi-hole to listen for DNS requests on two different interfaces. If you've got Pi-hole running on your Raspberry Pi and you're using both Wi-Fi and Ethernet connections, you might find that Pi-hole is only working on one of these. But don't worry, it's really easy to set up Pi-hole to handle both interfaces. This guide will walk you through the steps to get your Pi-hole listening on both your wlan0 and eth1 interfaces.

wlan0 - 192.168.0.5
eth0 - 10.10.0.11

After setting up Pi-hole on my Raspberry Pi, I noticed it was only responding to DNS queries on the wlan0 interface. This is a default setting, but it meant my devices connected via Ethernet (different network/subnet) were not benefiting from Pi-hole's DNS filtering.

C:\Users\vsurr>nslookup google.com 10.10.0.11
DNS request timed out.
    timeout was 2 seconds.
Server:  UnKnown
Address:  10.10.0.11

To get Pi-hole to listen on both interfaces, I started by SSHing into my Raspberry Pi. Once logged in, I edited the Pi-hole configuration file located at /etc/pihole/setupVars.conf using the nano text editor.

In this file, I changed the PIHOLE_INTERFACE line to include both interfaces, like this, PIHOLE_INTERFACE=wlan0,eth0. After saving and exiting the editor, I simply restarted the Pi-hole DNS service with the command pihole restartdns.

This update prompted Pi-hole to start responding to DNS queries on both the WLAN and Ethernet interfaces. The change was immediate, and running an nslookup on the eth0 interface now showed successful responses, confirming that the fix worked perfectly.

C:\Users\vsurr>nslookup google.com 10.10.0.11
Server:  UnKnown
Address:  10.10.0.11

Non-authoritative answer:
Name:    google.com
Addresses:  2a00:1450:4009:818::200e
          172.217.169.46

You can also verify the changes in the admin GUI as shown below.

Written by
Suresh Vina
Tech enthusiast sharing Networking, Cloud & Automation insights. Join me in a welcoming space to learn & grow with simplicity and practicality.
Comments
More from Packetswitch
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Packetswitch.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.