Define local domain suffix for each interface

Hi,
in settings DHCP and DNS > General > Local domain I can define Local domain suffix appended to DHCP names and hosts file entries.

I wonder how to define different suffix for each interface. This would make sense to identify the subnet a client is connected to in Status > Overview > Active DHCP Leases.

In my OpenWrt router I have defined multiple interfaces:
lan
dmz
iot
guest

You can do it this way in /etc/config/dhcp:

config dhcp 'lan'
       option interface 'lan'
       option start '200'
       option limit '50'
       option leasetime '2h'
       list dhcp_option 'option:domain-name,"home.lan"'
config dhcp 'dmz'
       option interface 'dmz'
       option start '200'
       option limit '50'
       option leasetime '2h'
       list dhcp_option 'option:domain-name,"home.dmz"'
1 Like

I'm not sure if this is correct.
After setting

list dhcp_option 'domain,dmz'

I get this output of uci show dhcp:

dhcp.dmz=dhcp
dhcp.dmz.interface='dmz'
dhcp.dmz.start='100'
dhcp.dmz.limit='99'
dhcp.dmz.leasetime='12h'
dhcp.dmz.dhcp_option='6,172.16.50.11' '42,192.168.30.1' 'domain,dmz'

However with this setting DHCP is now working correctly, means other options are not set.

Further investigations results in this setting:

list dhcp_option '15,dmz'

But this is not working, either.

Sorry, but this is not, what I told you. Try the following line:

list dhcp_option 'option:domain-name,"dmz"'

It is important to enclose the string dmz in double-quotes, otherwise it won't work.

Based on what objective facts?

Please note: dhcp options are offers from the DHCP server to the DHCP client. The client is not obliged to accept these offers. Some clients do, other clients do not.

For example: my linux clients accept all advertised dhcp options, but android devices do not.

Understood.
Does this setting in /etc/config/dhcp impact any of the options in section config dnsmasq?

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

According to this wiki entry

means: DNS domain handed out to DHCP clients. So it is a general setting for all interfaces. If you want interface specific domain names, you must delete this line in the config dnsmasq section.

All other listed options do not interfere with interface specific domain names ... as far as I can see.

After setting this DHCP option, the suffix is not added to any client in any subnet.
Means in LuCI > Status > Overview > Active DHCP Leases any hostname has no suffix.

That is the correct and expected behaviour.

list dhcp_option 'option:domain-name,"dmz"'

sets the search option in the client's resolv.conf file so that it looks like this:

search dmz

If you want the dmz suffix added to a hostname, then you must define it within the client or via a host section in the router's /etc/config/dhcp file.

Sorry, I probably misunderstood your first posting.