VPN setup requires manually setting DNS servers?

Sin respostas
J.B. Nicholson-Owens
Desconectado
Joined: 06/09/2014

I'm running Trisquel 7 64-bit, fully updated as of the time/datestamp on
this post.

I'm trying to add a VPN entry (no password used, all done with
encryption keys) to a VPN provider that provides me with a set of setup
files intended for use with OpenVPN. I can easily add the VPN
configuration by obtaining the OpenVPN config files from my VPN provider
and pointing to the appropriate .conf file.

Using the VPN in this way works with one exception: Engaging and
disengaging the VPN via the GNOME network panel doesn't automatically
switch the DNS server. The DNS server used by the VPN is different than
the one I need when I'm not on the VPN. So when I'm not on the VPN I
need to use my local network's DNS server, and when I'm on the VPN I
need to use the VPN provider's DNS server.

I'd like this switching to be automatic every time I activate or
deactivate the VPN.

I don't remember this being an issue with other GNU/Linux distributions
running comparable software such as Ubuntu LTE, Fedora 20, or the latest
RHEL. I could add the OpenVPN .conf file, activate the VPN
configuration, and use the VPN without changing /etc/resolv.conf or
needing root privilege at all.

Is there some way to get the DNS server to automatically switch DNS
servers as I activate or deactivate my VPN?

Here's what I've tried:
- manually edit /etc/resolv.conf to change my DNS server's IP address:
this works but seems entirely unwise to do and should not be needed (nor
would this work if I didn't have sudo power on the system). I'm guessing
I should be leaving /etc/resolv.conf to be managed by some process and
that file should specify the proper DNS server for my local network so
other users on the system can resolve addresses properly using the local
network DNS server.

- adding the VPN provider's DNS server in the VPN configuration in the
GNOME panel for the VPN, and adding my local network's DNS server in the
"Wired connection 1" default network connection: this appears to have no
effect whatsoever.

I could use some help understanding what should be the proper setup and
determining what I need to do to automatically switch DNS servers as I
activate or deactivate my VPN. If I've described something that sticks
out as clearly wrongheaded, please do point that out as well.

Thanks.