Best way to create a second dnsmasq instance without dhcp

I need to run a second instance of dnsmasq as a pure dns forwarding server.
I am trying to disable dhcp on that second dnsmasq instance from luci and I could not find any obvious option. There is an option "Ignore interface" at the interface level but it will disable dhcp for both instances which I do not want.

Can I rely on the "Max. DHCP leases" option and setting it to 0? Logically, not granting any DHCP lease should be as good as deactivating DHCP. Am I missing something with this setup, do I run the risk of a conflict between both dnsmasq instances?

Luci isn’t the tool for complex setups!
You can always make the complex changes you want directly in the config files or with uci code.

1 Like

Thanks! Noted your point, do you kow which setting in the config file would be able to disable DHCP only for that 2nd dnsmaq instance? Even in the config files, the only related settings I can find are interface level, not instance level.

Do I understand you correctly, running dnsmasq on the same subnet a second time but disable DHCPv4?

Yes - same subnet. The second dnsmas instance will have dhcp disabled and a separate dns port number

I don't know if it is the best way but works in a test setup for me.

add a second lan interface e.g.,

config interface 'lan2'
	option proto 'none'
	option device '@lan'

and a second dnsmasq instance

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '0'
        option local '/lan/'
        option domain 'lan'
        list interface 'lan2'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/'
        option localservice '1'
        option ednspacket_max '1232'
        option dnssec '1'
        option port '54'


This is very interesting, please correct me if I am wrong
1- it would create a VLAN called "lan2"
2- The second dnsmasq instance attaches to lan2
3- I can now disable DHCP in lan2 via luci

I have few basic questions: wouldn't lan2 have the same IP as lan in this setup - would this cause any issue? Would devices connect to lan safely ignoring lan2?