I have setup a site-2-site VPN connecting 2 subnets.
Each subnet has its own domain (suffix):
.lan
.lan2
One subnet ( .lan2) is managed by an openWrt router using dnsmasq.
When I am connected to .lan2 subnet then it is already properly resolving hostnames of
my .lan2 subnet if .lan2 is appended. (e.g. ping mac-jan.lan2)
my .lan2 subnet if .lan2 is missing (e.g. ping mac-jan)
my .lan subnet if .lan is appended. (e.g. ping nuc1.lan)
I want to configure openWrt so that when I am connected to .lan2 subnet it is also able to resolve hostnames of
my .lan subnet if .lan is missing (e.g. ping nuc1)
So somehow I think I should configure a DNS search suffix list or domain suffix list and extend/add .lan to it but I have no how idea I should configure this.
"lan" is a known private domain, but "lan2" isn't, and that could confuse some software. I would use "lan" / "intranet", or subdomains "loc1.lan" / "loc2.lan".
You just have to instruct each DNS to ask the other one for names that are in the other domain/subdomain: at the "config dnsmasq" section in "/etc/config/dhcp", add a "list server '/loc2.lan/1.2.3.4'", where "1.2.3.4" is the IP address of the other DNS.
So if I then connect my macbook to that wifi network (.lan2), it will use lan and lan2 as DNS Search Domains which I have verified in my macbook DNS settings:
So when ping HOSTNAMEXX.lan works then also ping HOSTNAMEXX (without .lan suffix) will work thanks to this.