In order to let openvpn
to alter the system DNS settings, therefore eliminating the leak, add the following lines at the end of the your *.ovpn
configuration file:
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Most likely that solution will help, depending on the OpenVPN server settings.
If you're curious of the meaning of the directives above, those do the following:
script-security 2
- this directive offers policy-level control over OpenVPN's usage of external programs and scripts. Script security level 2 allows calling of built-in executables and user-defined scripts.up
anddown
directive specifiesdirectives specify the commandcommands to run after successful TUN/TAP device open and close, in this case, which are/etc/openvpn/update-resolv-conf
and/etc/openvpn/update-resolv-conf
correspondingly. These scripts align the resolv.conf with the DNS address supplied by OpenVPN server, returning it to its original state when the connection is closed.