[Question] How to allow local DNS resolvers using Windows openvpn.exe version?
@d12fk is already working on this.
Since Dec 17, 2025.
- Dominant language
- C
- Stars
- 14.6k
- Forks
- 3.4k
- PR merge metrics
- No merged PRs in 30d
Description
Hey,
I would like to use a local DNS server for Open VPN network adapter.
I've tried to connect to a VPn server using a command line:
openvpn.exe --config al.ovpn
Then I change DNS servers using a PowerShell command:
Set-DnsClientServerAddress -InterfaceAlias "Open VPN adapter name" -ServerAddresses ("1.1.1.1", "8.8.8.8")
and DNS resolution work perfectly fine:
nslookup google.com
Server: one.one.one.one
Address: 1.1.1.1
Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:4001:827::200e
142.250.186.46
However, if I set local DNS server using a PowerShell command:
Set-DnsClientServerAddress -InterfaceAlias "Open VPN adapter name" -ServerAddresses ("127.0.0.2", "127.0.0.2")
DNS resolution doesn't work:
nslookup google.com
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 127.0.0.2
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
It seems there is some kind of additional protection (maybe a leak protection) that block UDP requests to the localhost.
I wonder how to configure open vpn connection to allow DNS requests to the localhost?
P.S. I have tried OpenVPN Connect app (Windows version) and found special settings for this case:
When the checkbox is checked, I can change DNS server to the local one and it works.
When the checkbox is unchecked and DNS resolution doesn't work, app logs has additional rows on a connection start:
...
block IPv4 DNS requests to loopback from other apps
block IPv6 DNS requests to loopback from other apps
...
Does openvpn daemon vesion has this feature? If yes, how I could disable it?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.