DNS Leak with VPNBook (OpenVPN)

My current setup:

OS: Ubuntu 17.04

Service: OpenVPN

VPN: VPNBook (free)

VPN Setup:

I setup VPNBook on my Ubuntu OS by downloading the US1 Files on this link:


Then I used the terminal to navigate to the folder and I ran this command to start the service:

openvpn --config vpnbook-us1-tcp443.ovpn

After that, I entered the username and password and it proceeded to finish the setup. Once it Finished, I checked my IP with this site:


My IP Addresses was hidden, but when I ran the standard test, it was still showing my ISP name for the DNS Leak. How can I change the DNS to OpenDNS Addresses (, while using VPNBook? I checked the file located at /etc/resolv.conf but I get this message:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.


It sais any changes will be overwriten, so how can I still change the DNS to OpenDNS to preven any further leaks while using VPNBook?


You can specify the DNS servers to use in your OpenVPN client configuration.

So for OpenDNS it would be the following:

dhcp-option DNS
dhcp-option DNS
  • Would I add that into the /etc/resolv.conf file?
    – TazerFace
    Aug 19 '17 at 19:39
  • You need to add it to your OpenVPN client configuration. In your case it would be vpnbook-us1-tcp443.ovpn
    – Stu
    Aug 19 '17 at 19:42
  • That's what I mean. I don't know how to view or change the configuration file. When I run openvpn --config vpnbook-us1-tcp443.ovpn it just asks for username and password, nothing about dhcp-option
    – TazerFace
    Aug 19 '17 at 20:07
  • 1
    Have you edited the .ovpn file in a text editor and added the dhcp-option lines? It should look like this pastebin.com/gSvKjRzD
    – Stu
    Aug 19 '17 at 20:10
  • Hmm, perhaps resolved is keeping your ISP DNS server. You should be able to check with systemd-resolve --status. It's a bit of a hack but you could just stop resovled and edit resolve.conf with the DNS servers you want.
    – Stu
    Aug 20 '17 at 22:23

Since you're on Linux, you would have to change your resolv file on the fly. You can invoke a script when the VPN goes up or down to take care of that.

Here is a link that describes the process: http://www.linuxquestions.org/questions/linux-networking-3/how-i-think-i-solved-dns-leakage-on-my-centos-7-pc-4175602864/

And for Ubuntu specifically: How To Fix OpenVPN DNS Leak in Linux

Verify that your /etc/resolv.conf has changed after launching Openvpn and is restored when Openvpn terminates.

  • I don't think that only resolv.conf can provide dns server information. for example /etc/system/network-scripts/ifcfg-eth0 has dnsserver param. under linux you could use github.com/macvk/dnsleaktest or other tool to detect real dns servers.
    – vadim_hr
    Jun 24 '18 at 13:45

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.