Hello everyone,
I have a remote OpenVPN server on a DD-WRT to which I'm connecting from a macOS based laptop with Tunnelblick. The server network is 192.168.0.0/24 and the client one is 192.168.1.0/24. On both the server and client routers I have set some aliases in the hosts file, in order to access nodes more quickly. These aliases work fine on both sides, and I have put the following options in the server conf file so the clients will use it as their DNS server when they are connected to the VPN :
push "dhcp-option DNS 192.168.0.2"
push "dhcp-option DOMAIN lan"
The problem is that with this conf, the clients can use the server's aliases but this overrides the client's DNS settings and it cannot use the other aliases anymore. I have tried setting a secondary DNS both manually in the client's network settings and with the following options in the client's conf file :
dhcp-option DNS 192.168.1.1
But from what I have understood, the way macOS handles DNS entries means that only the first one will be used, until it doesn't respond. In my case, the primary one (the VPN server) always answer, but when asked for an alias that belongs to the client's network, it greets me with :
ping: cannot resolve my_alias: Unknown host
This behavior seems correct because if I change the order of the DNS entries by putting the local one first and the VPN one after, the result is reversed : I can use local aliases but I can't use the remote ones anymore.
This seems to be more due to the way the DNS entries are used than the way my setup is configured, but I don't face this problem with a Windows client, since the tun interface seems to get its own DNS entry (the VPN server's IP that's been pushed). Then the client seems to use both the real and tun interface and therefore manages to reach both DNS servers and use all the aliases. That doesn't seem to be the case under macOS.
I've spent hours looking for a way to fix this, without success. I didn't even managed to find any similar case, even though this seems to me like a pretty important use case.
Is there a way to configure OpenVPN so that this works ? Or maybe I'm completely missing something here.
Below are the server and client confs :
port 1194
proto udp
dev tun
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem
dh /tmp/openvpn/dh.pem
tls-auth /tmp/openvpn/ta.key 0
server 10.8.1.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
log-append /var/log/openvpn
verb 3
management localhost 5001
push "route 192.168.0.0 255.255.255.0"
push "dhcp-option DNS 192.168.0.2"
push "dhcp-option DOMAIN lan"
client
proto udp
dev tun
remote my_remote_domain 1194
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert Me.crt
key Me.key
tls-auth ta.key 1
cipher AES-256-CBC
comp-lzo
verb 3
Thanks
Scentle5S