One interface with multiple DNS local domains?

I'm quite confused trying to sort this out so thought I'd come here to ask.

I have my LAN interface which at the moment is set to the .lan DNS suffix for local clients. I want to have another local DNS domain for that LAN interface, so as well as .lan, I'd also have something else such as .home etc. I haven't even worked out how to change the suffix for just a single interface. For example, if I change "DNS search domains" in Advanced Settings from lan to home (or have both of them), it has no effect on the DNS suffix. Neither does DHCP option 15 or 119. I can ping openwrt.lan but still not openwrt.home. The only way I've found to actually change the DNS suffix is to go to DNS and DHCP settings and change the following two settings.

So ignoring the multiple DNS local domains for a single interface, how would I even have separate interfaces have their own DNS local domains as it seems that the "Local server" and "Local domain" field are global for all the interfaces on OpenWRT.

hi,

you can run multiple dnsmasq instances with their own configuration.
you cannot create new entity via luci, have to edit /etc/config/dhcp but once it is done then you can edit config via luci.

/etc/config/dhcp:

# by default it looks like this

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
[..]

# you can change it to
config dnsmasq 'lan'
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        [..]

config dnsmasq 'home'
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/home/'
        option domain 'home'
        [..]

it is not full config obviously just an example to give idea. After the change you should service dnsmasq restart then ready to continue editing in luci.

by naming the instances config dnsmasq 'lan' and config dnsmasq 'home' you can also bind other configuration items to a specific instance by specifying the option instance 'lan' in their respective config section. for example host configuration will be available for both dnsmasq instances by default unless you add the option instance.

good luck.

2 Likes

Luci>Network>DHCP and DNS>Hostnames

1 Like

Can confirm this works, appreciate the quick help! Thank you!

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