Multiple dnsmasq instances without manually specifying different upstream servers

I'm setting up two instances of dnsmasq so I can resolve DNS queries like this:

VLAN1 -> dnsmasq1 -> ISP's DNS
VLAN2 -> dnsmasq2 -> VPN's DNS

I'd like to know if I can do this without manually specifying IPs for the ISP's DNS and the VPN's DNS in the config dnsmasq sections.


I have a WAN interface and a VPN interface with a dedicated VLAN for each. Everything is currently working as expected.

config interface 'wan'
	option device 'wan'
	option proto 'dhcp'

config interface 'vpn'
	option proto 'wireguard'
	option private_key '...'
	list addresses '...'
	list addresses '...'
	list dns '128.1.1.1'

This results in the following nameservers in /tmp/resolv.conf.d/resolv.conf.auto (not the real IPs):

# Interface vpn
nameserver 128.1.1.1
# Interface wan
nameserver 123.123.123.123
nameserver 123.123.123.124

At the moment I have a single dnsmasq instance with split DNS via option noresolv '1'. I'm using the ISP's upstream servers in the list server section. I would prefer to use the nameservers assigned by the ISP for this.

For VLAN2 I'm using a separate dhcp section with dhcp_option 6 to push out the VPN's upstream server. For these clients local hostnames aren't resolved by OpenWRT.

To solve both of these issues I'd like to set up a separate dnsmasq instance for each interface so that OpenWRT can resolve local clients on each VLAN, and forward other requests to the appropriate upstream server.

I was hoping to do something like this:

config dnsmasq 'lan'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.lan'

...

config dnsmasq 'vpn'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.vpn'

But the existing resolv.conf.auto file has both sets of upstream servers in it.

I know I could parse resolv.conf.auto with a script but I'm wondering if there's a standard way to configure it.

Thanks!