How do set individual domains per VLAN?

Does someone has a working recipe for individual domains per vlan? Like VLAN 1 gets and VLAN 2 gets My search engine usage skills do not reveal any useful results.

I'm looking for details on where, what, and how I should set in /etc/config/dhcp: local, and domain, and I would like to know if you use local config overwrites/additions via conf-file=/etc/dnsmasq.conf.

I have a somehow working setup but this is rather cumberstone, and still has issues with PTR for DHCPv6 assignments from 2000::/3.

And I'm still not sure if I'm holding it wrong, or if I have found a config generation bug, present in 21.03 and 22.03, but on 22.03 it causes dnsmasq to crash.

Important: do not set a general local domain!!!
Instead: define a local domain per interface via a dhcp-option like this:

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

This is working on an IPv4-only system. Don't know, whether it's working with IPv6.

Good luck!

My clients get via DHCP and DHCPv6 the DHCP(v6) Option for their domain-name, so the client is aware of its own FQDN and search-domains works, too.

But AFAIK this alone does not solve the issue of having "proper" PTR served by dnsmasq.
You need to have --domain and --local set.

Having not set a default domain and --dhcp-fqdn gets refused by dnsmasq.

Like I've written, even my somehow glued together config works for IPv4 and IPv6, except for IPv6 GUA addresses out of 2000::/3.

I do really like links without any explanation... /s, but do you want to say I need individual dnsmasq instances in /etc/config/dhcp and can not do it with a single one?

Edit: And does this solve my issue that everything is working except IPv6 GUA?

I believe the word you were looking for is thanks, since your searching skills didn't reveal that.

I don't see how dnsmasq can distinguish them.

Works fine for my setup with 3 interfaces however.

AFAIK the client uses the dhcp-option domain-name just for feeding its /etc/resolv.conf (creating a search option). I think, it does not generate any PTR data on the router. Perhaps somebody else can jump in.

Because indicates that its a totally valid use-case having multiple domains in --local like --local=/ and having set --domain multiple times, too within a single config for a single process.

From what I have tried you cannot define the option domain multiple times in uci, or the last entry will prevail.
If you try with list domain it is not recognized.

1 Like