The solution is to ensure that once connected to the VPN, you are using ONLY the DNS server/s provided by the VPN service.
As of OpenVPN version 2.3.9 you can now prevent DNS leaks by specifying a new OpenVPN option. Simply open the .conf (or .ovpn) file for the server that you are connecting to and add the following on a new line. For more information see the OpenVPN manual.
If for any reason you are unable to use the solution above continue reading.
Please note that as this problem normally only affects windows clients, only solutions for Windows appear here.
3 basic steps to fix the problem;
If you are using OpenVPN on Windows XP/Vista/7 then a fully automated solution is available.
Download dnsfixsetup.exe - (md5 checksum: f212a015a890bd2dae67bc8f8aa8bfd9)
After installation, when you connect to a VPN server, a batch file will be run executing the 3 steps above.
Three scripts are generated for each OpenVPN configuration file;
The solution below does not switch the adapter to static if you are using DHCP. If you do not switch to a static IP configuration and your computer renews its IP address whilst connected to the VPN, the DNS settings may be overwritten. It is highly recommended to switch to a static IP configuration.
netsh interface show interface
netsh interface IPv4 set dnsserver "Local Area Connection" static 0.0.0.0 both
netsh interface IPv4 set dnsserver "Local Area Connection" dhcp