I have an OpenVPN server set up at 192.168.0.1 with subnet topology. This is working properly, clients can connect and reach the server, and interact with server-side resources.
I have configured a learn-address.sh script to interact with dnsmasq to enumerate all clients that connect to the server. Each client gets assigned a hostname
(e.g., host1.privatesubnet.example.com, host2.privatesubnet.example.com, etc. ) which dnsmasq keeps track of so it can answer DNS queries for each hostname and return the VPN IP address of the client. I have client-config-dir set up, and for trusted clients, I include
push dhcp-option DNS 192.168.0.1
. On the clients, I'm including
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Everything on the server side is apparently working properly. From the trusted clients, I can run
nslookup host1.privatesubnet.example.com 192.168.0.1
and it returns the correct IP address to the other client, which I can then ping, ssh to, whatever. That all works.
However, the lan on my client has a dhcp server and its own DNS for local clients, so when I'm connected to both lan and vpn, resolvconf -l looks like
#Generated by openvpn/update-resolv-conf
nameserver 192.168.0.1
#Generated by NetworkManager
domain mydomain.local
search mydomain.local lan lan
nameserver 10.10.10.1
with the above, I can directly ping somehost.mydomain.local, but I can't ping host1.privatesubnet.example.com by name, only by IP. If I manually delete the other nameserver and domain entries from the resolv.conf, I can ping host1.privatesubnet.example.com by name, but not somehost.mydomain.local by name, and the internet doesn't work because mydomain.local provides DNS lookup for internet addresses.
Nothing I've tried has allowed me to query DNS addresses for both local domains at the same time, either the DHCP DNS stomps the OpenVPN DNS or vice versa. What am I missing?