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 , , and the VPN server with these instructions ,

After setting everything up and importing the ovpn file to the client, the tunnel is created and on 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” push “dhcp-option DNS” 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 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.


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!