Question

OpenVPN Server does not route DNS through VPN

  • Posted November 26, 2021
  • VPN

Hi I setup a OpenVPN server on Ubuntu 20 with these instructions https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ubuntu-20-04-server-on-a-digitalocean-droplet , https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04 , and the VPN server with these instructions https://www.digitalocean.com/community/tutorials/how-to-set-up-and-configure-a-certificate-authority-ca-on-ubuntu-20-04 , https://www.digitalocean.com/community/tutorials/how-to-set-up-and-configure-an-openvpn-server-on-ubuntu-20-04.

After setting everything up and importing the ovpn file to the client, the tunnel is created and on dnsleaktest.com it shows the Digital Ocean VPN IP. However when performing a DNS leak test it shows my home public IP as the DNS server. I thought it may have been because I’m running unbound on my home router so I took it to a friends and tried it there with a basic ISP setup and it still returns the home IP as the DNS server.

I have verified that push “redirect-gateway def1 bypass-dhcp” and push “dhcp-option DNS 208.67.222.222” push “dhcp-option DNS 208.67.220.220” are uncommented in /etc/openvpn/server/server.conf

Is there something that I can add or change in the config file to make it use the DNS provided by the server instead of the home public IP?

Also I just tried the Marketplace pre configured openvpn + pihole with https://marketplace.digitalocean.com/apps/openvpn-pihole and the same issue arises. Also when I try to login into the web admin page after connecting to the VPN on the client the page does not resolve and returns with a fail to load response.

Subscribe
Share

Update - Issue fixed

Mistake on my part. I forgot to uncomment this section

script-security 2 up /etc/openvpn/update-systemd-resolved down /etc/openvpn/update-systemd-resolved down-pre dhcp-option DOMAIN-ROUTE .

in the server.conf file for systemd-resolved on Linux Distros.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!