Solving DNS problems with OpenVPN on Ubuntu box
I want to share some experiences working with VPN from Ubuntu. I had some trouble using OpenVPN as after connecting I couldn’t access any resource referenced by a domain name.
I couldn’t find any solution to this problem but finally after trying a few things out, I have come out with a solution I want to share below.
Assuming you have OpenVPN installed and working ‘.ovpn’ configuration file (but without proper DNS resolving) follow the steps below:
1. Install resolveconf
1 | sudo apt-get install resolvconf |
2. Link your auto-generated resolve.conf to existing ‘/etc/resolve.conf’
1 2 3 4 | cd /etc #backup your original resolve.conf just in case cp resolv.con resolv.conf.orig ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf |
3. Add the following lines to the bottom of your ‘.ovpn’ configuration file:
1 2 | up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf |
4. Run openvpn with the following flags (as root):
1 | openvpn --script-security 2 --config youropenvpnconfig.ovpn |
That should do it.
Enjoy
Related Posts
No Releated Posts
thanks a lot! this worked flawless for ubuntu Meerkat.
Worked flawlessly for me on Ubuntu Desktop 11.10 x32
It really works. Thanks a lot.