Pihole doesn't block ads with VPN connected

I have pihole up and running for more than one year and everything worked perfectly until yesterday when i bought a subscription for Mullvad VPN. Now, when i’m connected to Mullvad, pihole doesnt seem to block the ads anymore.

What should i do in order to get pihole running also when i’m connected to the VPN?

so you’re telling us, that your VPN does what it should do?

Mullvad can block ads just like Pi-hole, or you can tell Mullvad to use a local DNS source. The settings section of their app will show the various options.

I am a Mullvad subscriber myself.

Pi Hole won’t work when you’re connected to your third party VPN provider. All traffic is end to end encrypted, including DNS requests. As far as I’m aware, I don’t think you’ll be able to get the two to work in tandem.

I think it depends on your VPN. Pihole acts as a DNS server, so its job is to translate domain names into IP addresses - and then block any that it knows are ads etc from being resolved, so your device won’t know the address to connect to.

When you use a VPN, typically all your traffic is routed through the VPN - therefore it will usually also act as a DNS server and won’t block ads.

I believe you have a few options you could explore.

  1. Is that you configure your router to use the VPN, rather than your client. That means your router (I think) will do DNS locally then use the VPN for the internet traffic.

  2. You see if your VPN can be configured not to assign a new DNS server to your client.

If neither can be done, I think there may be a way to configure your OS to split traffic to DNS and VPN but not sure how sorry!

The point of a VPN is to ensure nobody interferes with your connexion. The point of Pihole is to lie about domains to block nasty content providers.

Unless you are considered a rrusted network admin by the VPN server, those objectives are incompatible. Find a VPN that allows you to use the LAN-provided DNS resolver.

My work’s VPN was still trying to reach their infra domains by asking Pihole. Was hard to find a way to circumvent that…

In light of Reddit’s general enshittification, I’ve moved on - you should too.

try this free service free Block Ads Pi-Hole VPN - BA.net Dapp Studio

That is because the Mullvad client is sending all your traffic over the VPN. You can set up what’s called a “split tunnel” so that it makes an exception for pi-hole. This article explains how.

I’ve not looked at this myself, but am interested in doing something similar. It sounds like a second pihole instance is needed which is logged on to the VPN service and then share the internet from that pihole instance locally…

Would be interested in thoughts and feedback

Thx

When you are connected to your VPN provider, you are using their DNS servers, not your DNS Servers. Personally, I don’t use VPN on my devices when I am connected to my own network. However, when using cellular, or on another network, it do use VPN, either from a provider, or to get back to my network.

There is nothing you can do about it. Unless you wanna cause a dns leak, one of your only options is PiVPN. (You can do this in the cloud and with pihole too. I recommend making your own personal vpn with linode because most vpn services are trash.) Your second option is just use NextDNS.

I will leave that up to you :slight_smile:

nice irony…the question was if it is possible to have pihole running together with the VPN.

sounds really great, but i cant find those settings in Mullvad app for macOS. :frowning:

Wouldn’t that be a dns leak?

Not entirely true. However it really does depend on how the VPN is setup and if the software has the option to set a custom DNS, if it does you can set the Pi-Hole as DNS server for the VPN.

I have a VPN built into my router, and I use dhcp-option=6 in DNSmasq on the router to have the VPN DNS query my Pi-Hole.

Some, but very few vpn services allow you to customise the dns provider (Despite this defeating the purpose of a vpn). Mullvad does provide the ability to use your local DNS configuration.
A potential middle ground could be a service like NextDNS which provides a customisable encrypted global DNS sinkhole for a low price, while maintaining native internet speeds.

NextDNS is basically a “cloud based Pihole” to put it loosely.

You see the Mullvad icon up in the menu bar? Click on it and there will be a small gear icon in the upper right hand corner. Click on it.

You will then see an option for Preferences and Advanced. To use the built in ad blocker, click on preferences then scroll down and enable block ads and any other options you deem wanted. To use your own dns servers, click on advanced, scroll down to the bottom and enabled where it says use custom dns server. You will have to turn off all the built in Mullvad blockers before this becomes enabled.

Possibly. If the DNS server is your own (like in my case) then I don’t see how it would really matter.

No, the point is to have a enrcypted connection, even when you are connected to shitty public wifis and you can still access your LAN, including pihole.