Having doubt on how to fix OpenVPN DNS leak?
To fix the issue ensure that once connected to the VPN, the server using ONLY the DNS server/s provided by the VPN service.
Here at Bobcares, we have seen several such OpenVPN related issues as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the cause for this error and see how to fix it.
What is DNS leak
OpenVPN has a special behavior in which it will not change the default DNS. It doesn’t encrypt the DNS request whereas only encrypts the connection to the Internet. the traffic of the server will be safe from others. However, the DNS request is not protected from others. This is a DNS leak.
OpenVPN should change DNS into its VPN DNS server and can revert into the original DNS. In Linux, it can be done by manually edit the file /etc/resolv.conf file.
So, in order to prevent DNS leak, OpenVPN needs another process. And it will update /etc/resolv.conf automatically.
How to fix OpenVPN DNS leak
Now, let’s see the suggestions our Support Engineers provide to our customers to resolve this error.
One of the methods that we follow is given below,
In Linux,
1. Edit The .ovpn File. We add these three lines of config into the .ovpn file.
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Now thel script named update-resolv-conf will update the /etc/resolv.conf file automatically. Therefore, it will force OpenVPN to use default DNS from the .ovpn file.
2. Run The .ovpn File
Then we run the .ovpn File with the below command.
openvpn –config name_of_your_file.ovpn
3. Finally we test DNS leak using any online tool
After testing if it shows the DNS changed other than the ISP DNS. That fixes the issue.
In Windows
Often, windows customers face OpenVPN DNS leak issues due to different reasons like Dynamic IP address. and misconfiguration. If the version is equal to or greater than 2.3.9, the DNS leaks can be prevented by specifying “block-outside-dns” in .conf (or .ovpn) file for the server.
If the version of OpenVPN older than 2.3.9,
1. Set static IP address properties for DHCP before connecting to the VPN.
2. Remove DNS settings for the primary interface after establishing the connection.
3. Switch back to DHCP if necessary or reapply original static DNS servers once the connection is established.
[Need any further assistance in fixing DNS errors? – We are here to help you.]
Conclusion
In short, to rectify the OpenVPN DNS leak issue, the server should use DNS server/s provided by the VPN service only. Today, we saw how our Support Engineers fix this error.
0 Comments