Uncategorized

openvpn: ubuntu server dns problems

when connecting to an openvpn server (at least on ubuntu 20.04) you lose your dns server, meaning you're not able to access any remote hosts via ip. 

you can basically sucessfully ping 8.8.8.8, but if you ping google.com it will fail, because it cannot translate google to an ip. 

the solution is here:

https://github.com/alfredopalhares/openvpn-update-resolv-conf

 

basically install openresolv

sudo apt-get install -y openresolv

 

add the instructions in the openvpn config file to update the dns after connection.

# This updates the resolvconf with dns settings
setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
down-pre

 

Leave a Reply

Your email address will not be published. Required fields are marked *