I have read the man pages on resolv.conf and resolvconf and resolvconf.conf but don't understand everything and feel I'm a tad lost on how I might (ahem) resolve this problem:
I have a LAN with a router that acts as DHCP and nameserver. The nameserver resolves all devices on this LAN either with no TLD or the .lan TLD. For example I can resolve with nslookup, ping, and any other tool names like "nas" and "nas.lan" that reach my NAS server (network accessible storage server). Any other names it forwards the request on to my ISP's DNSs.
My resolv.conf therefore looks like this:
# Generated by resolvconf domain lan nameserver 192.168.0.1
I get fine resolution of all LAN and WAN names.
I now connect to a Cisco VPN at work and resolvconf updates the resolv.conf to:
# Generated by resolvconf domain myworkplace.com search myworkplace.com lan nameserver 192.168.1.10 nameserver 192.168.1.11 nameserver 192.168.0.1
And now I cannot reach "nas" or "nas.lan" on my LAN anymore but I can reach "nas" and "nas.myworkplace.com" on the VPN. WAN names are now resolved by the VPN assigned namesever 192.168.1.10, and the NAS I reach this way is on the VPN not on my LAN (a different server).
Aside: I don't actually have any such name clash, but I provide it in the apocryphal example here because a solution clearly needs to cater for it.
Now what I would like to achieve is something like this:
"nas.lan" resolves to my LAN NAS "nas.myworkplace.com" resolves to the VPN NAS "nas" resolves to one or the other based on config (hints of resolv.conf's ndots setting here but not sure).
- Is this even doable with resolvconf?
- If not, is there some other way to do it (example using dnsmaq instead of libc as a resolver on my box?).
I appreciate any pointers here as I'm finding the man pages to be less than easy to digest and decrypt with a specific need like this in mind. I have searched on-line for a good while now and oddly enough only found others asking the same question (without answer) in other fora!
This isn't a problem unique to me, or my discovery clearly. Anyone on a LAN with devices they wants to see there, connecting to another LAN over a VPN seems likely to run into precisely this issue of being able to resolve only names on the VPN not the LAN while connected, needing to close the VPN to resolve LAN names again.