NetworkManager is not changing /etc/resolv.conf after openvpn dns push
Solution 1:
This works for me: http://www.softwarepassion.com/solving-dns-problems-with-openvpn-on-ubuntu-box/
The important step is adding following two lines of configuration into your client openvpn config file:
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Also ensure the resolvconf
package is installed on the client, because that update-resolv-conf
script depends on it.
It works with openvpn client service or command to start it manually.
However, the Ubuntu Network Manager doesn't this. It's an issue so far: https://bugs.launchpad.net/ubuntu/+source/openvpn/+bug/1211110
Solution 2:
Works for me after disabling NetworkManager's own dnsmasq.
Edit /etc/NetworkManager/NetworkManager.conf
#dns=dnsmasq
and restart NetworkManager
sudo restart network-manager
Solution 3:
Finally works (with standard NetworkManager and OVPN plugin)
nmcli -p connection modify MY_VPN_CONNECTION ipv4.never-default no
nmcli -p connection modify MY_VPN_CONNECTION ipv4.ignore-auto-dns no
nmcli -p connection modify MY_VPN_CONNECTION ipv4.dns-priority -42
In this case once VPN connection is established, all DNS requests are directed to VPN-supplied DNS servers without any manipulations with dnsmasq, up/down/dispatch helper scripts.