Pihole + VPN (without static IP option)

First thing first:

Set a static IP on your raspberry from the same range that your router is providing DHCP ips:

https://www.raspberrypi.org/forums/viewtopic.php?p=1070893#p1070899

Then, run a pihole -r and reconfigure.

Make sure all the IPs are matching and everything is updated.

After that, make sure Pi-hole is set-up to respond to the interface that the request is coming on (I'm assuming this would be eth0 in this case ).

Once set-up like that, your raspberry will retain the IP and it will be easier to use that, as it survives reboots and always stays the same.

Once you are done with those settings, make sure you use the raspberry IP (the one you specified in /etc/dhcpcd.conf), as your DNS server on your clients.

1 Like

I sat my dhcpcd.conf as my router, but unfortunately nothing has been changed.
I still don't get DNS resolve on my PC when setting it to my raspberry pi.

What I don't understand is how we are bypassing the VPN issue with those configuration, it seems to me the regular configuration as if I didn't have VPN.

dhcpcd.conf needs to be set and edited on the raspberry as it pertains to that device only.

What you are trying to achieve with that is a stable static IP, non DHCP provided by the router.

That way, your DNS server IP will be constant in the network, regardless of reboots, power outages and all.

First, try to enable, configure and test the Pi-hole at LAN level. Once you are done with that, you can start working towards expanding it's reach to the VPN server too.

1 Like

My pi-hole works fine on my raspberry (is this what you mean by LAN level?), it blocks ads and I can use the internet.
The troubles begin when I try to set my raspberry as DNS for other devices I.e. my PC.

Nope.

LAN stands for Local Area Network.
What you are describing is LOCAL (as in only on the raspberry).

In order to achieve what you need, set a static IP on the raspberry via dhcpcd.conf.
Then as sated above, reconfigure Pi-hole and make sure to select the correct interface that it will listen to. Once you have that done, troubleshoot it at LAN level (use the IP you set-up as your DNS server on your PC).

Once you have that figured out and fixed, you can focus on VPN.

I believe I miss something.
I'm connected to the internet on my raspberry via my router (WiFi), so I followed the link you added and configured my raspberry dhcpcd.conf as described.
Then, I reconfigured my pihole to point out to my raspberry dhcpcd.conf settings.
After I tried to change my PC's DNS to my raspberry IP and lost DNS resolve.

The problem in my opinion is it doesn't matter how I configure dhcpcd.conf, my pihole's IP is still 10.0.0.2 as it gets it from the router and although in the settings I see 10.0.0.XXX as my pihole's IP, I can access to its admin interface only with 10.0.0.2.

Also, after I changed my dhcpcd.conf settings, the IP of my wlan0 when I'm hovering is 10.0.0.2.

I even tried reserving an IP on my router's dhcpc for my raspberry, but as it turns out my raspberry just ignores it.

So what I'm missing?

The Pi-hole device needs a static (non-changing) IP address. It will not work when the Pi-hole device is given an address via router unless that IP is reserved at the router. This is called a static lease.

/etc/dhcpcd.conf must be set with a static IP address. If the IP address of the Pi-hole device changes in any way then you will break your network. If you tell clients that they need to use the DNS server at 10.0.0.2 and then the Pi-hole moves to 10.0.0.3 everything breaks.

First step is to make sure the Pi-hole is configured with a static IP address in the private range. Do not set it up with the address given by the VPN provider. The address should be in the range of addresses reserved for private networking. Private network - Wikipedia

Once you have that done, run pihole -d and let us know the token that it prints out. Then we can look at the configuration to make sure everything is set properly.

This is the thing, the raspberry doesn't get my vpn's IP, but only 10.0.0.2.

The token prints out the IP I set for the pihole (let's assume it's 10.0.0.111), but the pihole only response to 10.0.0.2

We will be unable to assist you if you do not follow the instructions we provide. Are you able to change the settings on the router?

Sorry, I really try to do what you say and follow your instructions, sometimes I might not understand everything due to lack of knowledge. Please accept my sincere apology.
I did again what you guys offered with two minor differences, (but with some achievement):

  1. I reserved an IP for my raspberry on my router 10.0.0.xxx)
  2. I changed my "interface listening behavior" on my pihole from "listen only on interface eth0" to "listen on all interfaces".

Then I changed my PC's DNS and now it's working (with one problem, when I'm testing the adblocker via pihole adblocker website, it says that "only partial blocking detected", why is that?

Also, in my pihole's admin interface it says that I have 3 clients, when I'm only connected to two devices to my pihole, is that OK? Is there any way to see which devices are connected to my pihole?

Please run pihole -d and provide the token.

usdvoc5ot4

From your debug log, your Pi-hole IP address is 10.0.0.106

That's the IP of the DNS server you need to use on the clients.

Can you share a screenshot of that ?

You can see the clients on the admin page under Top Clients (total) (scroll the page all the way to the bottom. on the left side, bellow the graphs).

1 Like

Also, it seems your raspberry is not configured properly.

*** [ DIAGNOSING ]: Networking
[✗] No IPv4 address(es) found on the eth0 interface.

[✗] No IPv6 address(es) found on the eth0 interface.

You are missing the IP settings ...

You can fix that if you specify the IP settings manually as instructed here:

Please follow the instructions above.

From a client, can you ping the Pi-Hole?

ping -c5 pi.hole

ping -c5 10.0.0.106

Looks like you have selected the ethernet interface on your Pi, not the wlan. From your debug log:

PIHOLE_INTERFACE=eth0

Yes you were right, I changed it to wlan0

Any thoughts about the partial adblocking detected issue?

Try re-configuring your Pi-hole setup.

Run a pihole -r and select reconfigure.

Also during setup, select the corect interface and parameters (interface and IP).

Done,
I still have two minor issues:

  1. The partial adblocking message I'm getting on the test site

  2. When I'm changing my WiFi DNS on my phone, there is no adblocking detected on the test site and it seems it doesn't use pihole.

Any thoughts?

That is most likely due to a non standard ad loading method that can't be handled at DNS level by Pi-hole. Consider installing a browser extension like ublockOrigin or adblock or something to that nature.

Most likely those requests go via IPV6. You need to either enable IPV6 on the pi + the router and broadcast the raspberry IPV6 IP as the DNS.

Check out

to see where your request is going through.

1 Like