How to specify multiple domain suffixes

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

  1. my .lan2 subnet if .lan2 is appended. (e.g. ping mac-jan.lan2)
  2. my .lan2 subnet if .lan2 is missing (e.g. ping mac-jan)
  3. 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

  1. 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.

Try this

Interface (e.g.LAN) > Advanced Settings > DNS search domain

Add lan and lan2

or

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.9.1'
	option netmask '255.255.255.0'
	option ip6assign '64'
	option delegate '0'
	option ip6hint '90'
	list dns_search 'lan'     <<<<
	list dns_search 'lan2'   <<<<

My two cents:

  • "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.

You are absolutely right, but you could not know that that was already discussed in a separate thread : DNS resolving static lease hostnames in other subnet - #2 by egc
:slight_smile:

Thanks,

I cannot set this through luci UI, instead I have updated /etc/config/network as follows and rebooted my router.

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option multicast_to_unicast '0'
        option hostname 'GL-AR300M-a38'
        option ipaddr '192.168.8.1'
        list dns_search 'lan3'
        list dns_search 'lan'
        list dns_search 'lan2'

It is working when I directly logon (via ssh) to my router and ping to a machine on my lan network:

root@travel-router:/etc/config# ping nuc1
PING nuc1 (192.168.2.11): 56 data bytes
64 bytes from 192.168.2.11: seq=0 ttl=64 time=1.997 ms
64 bytes from 192.168.2.11: seq=1 ttl=64 time=1.566 ms
^C
--- nuc1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1.566/1.781/1.997 ms
root@travel-router:/etc/config# 

Same ping is not working from my macbook.

mac-jan:~ jan$ ping nuc1
ping: cannot resolve nuc1: Unknown host
mac-jan:~ jan$ 

When consulting my macbook search domains it has only mentioned lan2 and not lan and lan3

image

Maybe, but this is just speculating, that DNSMasq only hands out the search domains to DHCP clients and not to static leases?

my macbook is a DHCP client for which a static lease is configured.

I also saw this post that might explain the issue:

The following change also didn't work:

according to the thread you linked it should be:
119,lan,lan2

Try that

Reboot client to get it

Excellent, that is indeed the change I need.
The 119, is of course mandatory.

So the actual changes:

  1. in openwrt luci webui.
  2. Navigate to: Network > Interfaces > click on edit for interface LAN (br-lan)
  3. Navigate to: DHCP Server > Advanced Settings
  4. specify the following DHCP-Options: 119,lan,lan2

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:

image

So when ping HOSTNAMEXX.lan works then also ping HOSTNAMEXX (without .lan suffix) will work thanks to this.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.