MullvadVPN Wireguard Tunnel + NextDNS DNS Resolution

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
junipergrower
DD-WRT Novice


Joined: 22 Apr 2020
Posts: 12

PostPosted: Fri Mar 03, 2023 6:16    Post subject: MullvadVPN Wireguard Tunnel + NextDNS DNS Resolution Reply with quote
I have set-up a Wireguard tunnel with Mullvad VPN on my Netgear R7000 dd-wrt router. The tunnel uses the defaults required for Mullvad VPN and works well.

However, I want to change the DNS resolution in the Wireguard tunnel to use NextDNS for DNS resolution instead of the default Mullvad DNS resolver.

Can anyone help me figure out how to change the DNS resolution in the Wireguard tunnel to use NextDNS, ideally using DNS-over-TLS or DNS-over-HTTPS?

Nothing that I have tried has worked so far.

Thank you in advance.
Sponsor
shb
DD-WRT Novice


Joined: 06 Oct 2013
Posts: 39

PostPosted: Fri Mar 03, 2023 6:38    Post subject: Reply with quote
I have a similar setup also on R7000, though my VPN provider is not Mullvad.

For my DNS I use pi-hole (192.168.9.103) pointing to 1.1.1.1

Depending on my mood, Wink sometimes I choose to have DNS traffic go out to the internet just via the WAN, and other times I choose to have them route thru the VPN tunnel (oet1).

The way I make that happen is with settings:

DNS Servers via Tunnel - I leave this one empty
Source Routing (PBR) - route SELECTED to VPN
Source for PBR - <whatever else>, 192.168.9.103/32

Note if the 103 address is already in the <whatever else> range, it is already going out via the VPN. And remember that "/32" is a subnet mask that means a range of one address.

* my mood usually is about data privacy, so usually I let it run out via the VPN (oet1).

A great tool to show what actual DNS is being used - is https://dnsleaktest.com
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12882
Location: Netherlands

PostPosted: Fri Mar 03, 2023 7:20    Post subject: Reply with quote
The WireGuard interface has a DNS setting.

This setting will tell DNSMasq which upstream DNS resolver to use.

So you can simply replace Mullvads DNS server with the one you like be it NextDNS or what ever.
But it only supports regular DNS53 and not secure DNS.

You can use secure DNS via DNSMasq/SmartDNS (see the SmartDNs guide a sticky in this forum) then just leave the WireGuard DNS setting empty.

If you do not use PBR (Policy Based Routing) everything will go via the tunnel so also your DNS, if you do use PBR then you can add the address of the DNS server in the WireGuard Destination Routing field and route via the tunnel.

WireGuard Documentation is a sticky in this forum: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
junipergrower
DD-WRT Novice


Joined: 22 Apr 2020
Posts: 12

PostPosted: Wed Mar 08, 2023 23:23    Post subject: Reply with quote
Thank you for the insights. I specifically am not using pi-hole as I want a non-self-hosted DNS resolver which can be accessed from outside the network. But your mention of choosing the DNS resolver based on mood has got me considering a pi-hole again!

shb wrote:
I have a similar setup also on R7000, though my VPN provider is not Mullvad.

For my DNS I use pi-hole (192.168.9.103) pointing to 1.1.1.1

Depending on my mood, Wink sometimes I choose to have DNS traffic go out to the internet just via the WAN, and other times I choose to have them route thru the VPN tunnel (oet1).

The way I make that happen is with settings:

DNS Servers via Tunnel - I leave this one empty
Source Routing (PBR) - route SELECTED to VPN
Source for PBR - <whatever else>, 192.168.9.103/32

Note if the 103 address is already in the <whatever else> range, it is already going out via the VPN. And remember that "/32" is a subnet mask that means a range of one address.

* my mood usually is about data privacy, so usually I let it run out via the VPN (oet1).

A great tool to show what actual DNS is being used - is https://dnsleaktest.com
Very Happy
junipergrower
DD-WRT Novice


Joined: 22 Apr 2020
Posts: 12

PostPosted: Wed Mar 08, 2023 23:25    Post subject: Reply with quote
Thank you for the ideas. As I am using secure DNS your suggestions about DNSMasq seem like the route to go. I am also looking into stubby as an alternative, but essentially it would accomplish the same thing as DNSMasq. Thanks again for the pointers.

egc wrote:
The WireGuard interface has a DNS setting.

This setting will tell DNSMasq which upstream DNS resolver to use.

So you can simply replace Mullvads DNS server with the one you like be it NextDNS or what ever.
But it only supports regular DNS53 and not secure DNS.

You can use secure DNS via DNSMasq/SmartDNS (see the SmartDNs guide a sticky in this forum) then just leave the WireGuard DNS setting empty.

If you do not use PBR (Policy Based Routing) everything will go via the tunnel so also your DNS, if you do use PBR then you can add the address of the DNS server in the WireGuard Destination Routing field and route via the tunnel.

WireGuard Documentation is a sticky in this forum: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum