Difference between revisions of "openvpn dns no leak config"

From thelinuxwiki
Jump to: navigation, search
(Created page with "==versions== O.S. = debian stretch openvpn = 2.4.0-6+deb9u3 network-manager-openvpn-gnome 1.2.8-2 ==problem== I am trying to tunnel all traffic including DNS through ...")
 
(solution)
 
Line 8: Line 8:
 
==solution==
 
==solution==
  
 +
To prevent system dns from appearing and being used in /etc/resolv.conf when using a VPN, edit your vpn configuration (i.e. the file in /etc/NetworkManager/system-connections/<vpn name>) so it's something like this:
  
 +
[ipv4]
 +
dns=<vpn dns server ip address>;
 +
ignore-auto-dns=true
 +
method=auto
 +
dns-priority=-1
  
[https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1211110/comments/92 https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1211110/comments/92]
+
<br>the negative dns-priority means only this dns server will be used.
 +
<br>Then reload the config file:
 +
<br>sudo nmcli c reload <vpn name>
  
To prevent system dns from appearing and being used in /etc/resolv.conf when using a VPN, edit your vpn configuration (i.e. the file in /etc/NetworkManager/system-connections/<vpn name>) so it's something like this:
+
<br>and toggle the vpn.
  
[ipv4]
+
<br>/etc/resolv.conf should now only include the one dns ip address defined in the config file.
dns=<vpn dns server ip address>;
+
ignore-auto-dns=true
+
method=auto
+
dns-priority=-1
+
  
the negative dns-priority means only this dns server will be used.
+
References:
Then reload the config file:
+
[https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html]
sudo nmcli c reload <vpn name>
+
[https://bugzilla.gnome.org/show_bug.cgi?id=758772 https://bugzilla.gnome.org/show_bug.cgi?id=758772]
  
and toggle the vpn.
+
solution from: [https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1211110/comments/92 https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1211110/comments/92]
  
/etc/resolv.conf should now only include the one dns ip address defined in the config file.
+
[[category:openvpn]]
 
+
[[category:dns]]
References:
+
https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html
+
https://bugzilla.gnome.org/show_bug.cgi?id=758772
+

Latest revision as of 16:35, 28 June 2019

versions

O.S. = debian stretch openvpn = 2.4.0-6+deb9u3 network-manager-openvpn-gnome 1.2.8-2

problem

I am trying to tunnel all traffic including DNS through a private VPN for privacy. The /etc/resolv.conf file Generated by NetworkManager needs to be changed upon vpn tunnel establishment.

solution

To prevent system dns from appearing and being used in /etc/resolv.conf when using a VPN, edit your vpn configuration (i.e. the file in /etc/NetworkManager/system-connections/<vpn name>) so it's something like this:

[ipv4]
dns=<vpn dns server ip address>;
ignore-auto-dns=true
method=auto
dns-priority=-1


the negative dns-priority means only this dns server will be used.
Then reload the config file:
sudo nmcli c reload <vpn name>


and toggle the vpn.


/etc/resolv.conf should now only include the one dns ip address defined in the config file.

References: https://developer.gnome.org/NetworkManager/stable/settings-ipv4.html https://bugzilla.gnome.org/show_bug.cgi?id=758772

solution from: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1211110/comments/92