Background
I'm running Debian stretch/stable; I installed openvpn from the repo abd downloaded the configuration file us1041.conf
(as an example) from my VPN provider into /etc/openvpn/us1041.conf
. I want openvpn to run at boot, so following the VPN provider's instructions, I created /etc/openvpn/auth.txt
with my credentials, add auth-user-pass auth.txt
to the configuration file, and added AUTOSTART="us1041"
to /etc/default/openvpn
.
If I manually add the nameservers to /etc/resolv.conf
:
nameserver 78.46.223.24
nameserver 162.242.211.137
the VPN works. Great! However, once I reboot, /etc/resolv.conf
is overwritten with the nameservers from my ISP, and no connections resolve.
Also, I'm not using network manager or any GUI app to configure the network. I didn't install a graphical interface and network configuration worked "out of the box." This is /etc/network/interfaces
:
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
allow-hotplug enp0s31f6
iface enp0s31f6 inet dhcp
Question
I think I need to use the /etc/openvpn/update-resolv-conf
script, but I'm not sure how to configure that with the configuration files that came from my VPN provider.
How can I get the VPN's nameservers to persist across reboots?
resolv.conf
. – JdeBP Nov 14 '17 at 07:00chattr +i /etc/resolv.conf
. – pevik Feb 02 '18 at 09:35