OPNsense Forum

English Forums => Virtual private networks => Topic started by: bazbaz on September 19, 2023, 04:03:34 PM

Title: OpenVPN dhcp-option DNS not working
Post by: bazbaz on September 19, 2023, 04:03:34 PM
Hi,
I have an OpenVPN access server to allow road warriors to establish a dialup VPN, validating credentials via LDAP+MFA.

All work well: tunnel is up and traffic is ok.

The only problem is that I need to assign an internal DNS Server resolver to connected clients. So I specified server's IP in instance settings, and in log I can find "SENT CONTROL []: 'PUSH_REPLY,register-dns,[.....]dhcp-option DNS 10.77.3.2,dhcp-option NTP 10.77.3.2[....]".

But this does not work, and client still is using only DNS servers it has before to start VPN. Any idea? I tried both with old "servers" settings and new "instances".
The client is OpenVPN Connect on Windows 11
Title: Re: OpenVPN dhcp-option DNS not working
Post by: newsense on September 19, 2023, 04:24:41 PM
Have a port forward on the VPN interface redirecting all DNS queries to your chosen resolver.
Title: Re: OpenVPN dhcp-option DNS not working
Post by: bazbaz on September 19, 2023, 05:09:15 PM
the problem is not on the firewall: if try manually to
Quote
nslookup
server x.x.x.x
mydomain.local

where x.x.x.x is the IP behind the tunnel, it works.

However, after many other tests, I discovered that "it work but I don't know why". If I run nslookup, I see that it points to local DNS server as resolver, and cannot solve internal names from DNS behind the VPN.
If I perform a "ping mydomain.local".. it works.

ipconfig /all does not reports the DNS server assigned by the VPN

so.. it works but I cannot understand why and how


Title: Re: OpenVPN dhcp-option DNS not working
Post by: meschmesch on September 20, 2023, 02:56:55 PM
add
block-outside-dns
to your client.ovpn
Title: Re: OpenVPN dhcp-option DNS not working
Post by: bazbaz on September 25, 2023, 09:28:24 AM
strange: it reports "unknown/unsupported options" when I try to connect
Title: Re: OpenVPN dhcp-option DNS not working
Post by: meschmesch on September 25, 2023, 03:40:27 PM
The client should be able to use it (I assume the client is so outdated). Irrespective make sure you indicate the correct DNS server in the server settings. In my case since I'm using adguard I additionally have a port forwarding that forwards any DNS requests originating from OpenVPN and not directed to the indicated DNS Server to the correct (internal) DNS server.
Title: Re: OpenVPN dhcp-option DNS not working
Post by: bazbaz on September 25, 2023, 04:12:35 PM
but your "ipconfig /all" and "nslookup" report the IP address of DNS server you assign from the VPN setting?
Title: Re: OpenVPN dhcp-option DNS not working
Post by: meschmesch on September 25, 2023, 05:29:38 PM
YES!