Overwrite OpenVPN Client DNS Settings

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


Joined: 30 Jan 2018
Posts: 20

PostPosted: Mon Nov 02, 2020 16:57    Post subject: Overwrite OpenVPN Client DNS Settings Reply with quote
Hello, is there a way to overwrite the DNS server used by my OpeVPN Client (NordVPN).

Normaly i use the DNS server wich are under Setup-Basic Setup Static DNS 1/2/3.

But when i connect to the VPN Client it overwrites the DNS settings. How can i use the Static DNS part again ?

MY OpenVPN Additional Config is:
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem


EX when i'm connected the DNS is the NordVPN DNS and my Static settings are the Google DNS Server. But every client connected to that VPN Client uses the NordVPN DNS.
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Mon Nov 02, 2020 17:13    Post subject: Reply with quote
What build? What router?

To get the best out of DDWRT and the forum, read and follow the forum guidelines:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087

See this thread use the document about DNS problems:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321686

In short one of the solutions is to add the following to the OpenVPN Additional config:
Code:
pull-filter ignore "dhcp-option DNS"

_________________
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
ymurawski
DD-WRT Novice


Joined: 30 Jan 2018
Posts: 20

PostPosted: Mon Nov 02, 2020 19:54    Post subject: Reply with quote
Hi, thanks for your answer.

i have the r44700 and a Netgear XR700 or R9000


I tested your Config, but i i use this, it uses the Original DNS from my ISP -> Vodafone

Under Setup-Basic Settings i took Static DNS 192.168.1.205 to my PihOle DNS

My additional VPN Server settings are now:
push "route 192.168.1.0 255.255.255.0"
push "route-gateway 192.168.1.1"

My DNSMASQ Settings are:
Dnsmasq Enable
No DNS Rebind Enable
Query DNS in Strict Order Enable

strict-order
server=192.168.1.205

Setup-Basic:
Use DNSMasq for DNS YES
DHCP-Authoritative YES

Static DNS1 192.168.1.205



So i just want that when i connect from outside to my OpenVPN Server to use the DNS 192.168.1.205
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Mon Nov 02, 2020 21:35    Post subject: Reply with quote
add to DNSMASQ Settings:
no-resolv

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Mon Nov 02, 2020 21:50    Post subject: Reply with quote
ymurawski wrote:
Hi, thanks for your answer.

i have the r44700 and a Netgear XR700 or R9000


I tested your Config, but i i use this, it uses the Original DNS from my ISP -> Vodafone

Under Setup-Basic Settings i took Static DNS 192.168.1.205 to my PihOle DNS

My additional VPN Server settings are now:
push "route 192.168.1.0 255.255.255.0"
push "route-gateway 192.168.1.1"

My DNSMASQ Settings are:
Dnsmasq Enable
No DNS Rebind Enable
Query DNS in Strict Order Enable

strict-order
server=192.168.1.205

Setup-Basic:
Use DNSMasq for DNS YES
DHCP-Authoritative YES

Static DNS1 192.168.1.205



So i just want that when i connect from outside to my OpenVPN Server to use the DNS 192.168.1.205


I am a bit confused, in your original post you mention a VPN client to Nord but now a VPN server appears Question

If you follow my advice you will no longer use the pushed DNS servers from Nord but the DNS servers you normally use.
And yes that can be your ISP's if you did not enable 'Ignore WAN DNS' on setup page.

Read the document I pointed to.

Alternatively and also documented use the no-resolv directive

_________________
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
ymurawski
DD-WRT Novice


Joined: 30 Jan 2018
Posts: 20

PostPosted: Mon Nov 02, 2020 21:57    Post subject: 1 Reply with quote
Sorry for confusing you.

OK again...

I am running a Openvpn Client and a OpenVpn Server on the router...

The VPN client is NordVPN connected.

When im not at home my phone connects to the Router with the VPN server.


When I'm at home all my devices using 192.168.1.205 for DNS.

When I'm outside and connected to VPN server my DNS is my Vodafone DNS. The IP is correct from Nordvpn. Just the DNS not.

No-resolv didn't work. Still the same.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Tue Nov 03, 2020 12:13    Post subject: Reply with quote
OK so to recap your clients connected to your own OVPN server are routed out for internet access via your Nord VPN client, so the OVPN servers subnet is also in the PBR range.

Like Nord is pushing its DNS server to you (and you seem to want that so discard my earlier posts) you have to push the DNS server to your OVPN clients.

See the OpenVPN server setup guide, there is a chapter abut pushing routes and DNS to your clients.

Link in my signature at the bottom of this post.

To get the best out of DDWRT and the forum, read and follow the forum guidelines:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087

e.g. pictures no more than 800 pixels width

_________________
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
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