4

I'm using Kubuntu 17.10, and use OpenVPN to connect to my corporate network. Since Ubuntu moved over to the new "netplan" way of doing network related things, I have found that several things in OpenVPN no longer work (like trying to set your DNS servers using dhcp-options and the up/down update-resolv-conf script).

My question is: is it possible to set a "netplan" that will set the OpenVPN's interface (tun0) DNS servers once tun0 is created? Something like:

network:
  version: 2
  renderer: networkd
  ethernets:
    tun0:
      dhcp4: yes
      dhcp6: no
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

I have managed to create my own vpn-up/vpn-down scripts which basically copy the appropriate yaml file over to /etc/netplan and then executes netplan apply, but this doesn't feel like the right way to do things.

0

If you're using OpenVPN on a desktop/laptop, I strongly suggest you use NetworkManager to control your VPN. It can pass through the right DNS information to the DNS backend (dnsmasq or systemd-resolved, depending on your release of Ubuntu), and it can do the right thing to bring up the VPN automatically on some interfaces, deal better with loss of connection, having to ask for credentials again, etc.

netplan does not have any special VPN support. Setting up a tun interface in an "ethernets:" stanza is likely not what you want, as will not create tun interfaces, and might in fact interfere with that OpenVPN might do to the interface; but if you really want to use it, you do need to roll your own vpn-up/vpn-down scripts triggered by openvpn to run 'netplan apply' with the right configuration files available in /etc/netplan.

  • I would disagree with you about using NetworkManager for OpenVPN. I tried, and it brought me nothing but heartache and grief. The only thing that worked properly for me was connecting from the terminal: sudo openvpn --config yourclientfile.ovpn. – Vanessa Deagan Mar 20 '18 at 19:39
  • @VanessaDeagan likely that you've changed your /etc/resolv.conf symlink? – heynnema Mar 27 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.