So I have been on a steep learning curve for the last few days, understanding dnsmasq and uci. I have taken your advice @vgaetera and looked at avoiding using DHCP for time based config management (since I now get that the client itself needs to reconnect to refresh DNS info).
I still cannot get everything to work, but here is what I have so far.
Here is my code snippet to create an additional instance of dnsmasq, which has the opendns server as one of its upstream resolvers
uci -q delete dhcp.dns_controlled
uci set dhcp.dns_controlled=dnsmasq
uci set dhcp.dns_controlled.domainneeded='1'
uci set dhcp.dns_controlled.boguspriv='1'
uci set dhcp.dns_controlled.filterwin2k='0'
uci set dhcp.dns_controlled.localise_queries='1'
uci set dhcp.dns_controlled.rebind_protection='1'
uci set dhcp.dns_controlled.rebind_localhost='1'
uci set dhcp.dns_controlled.local='/lan/'
uci set dhcp.dns_controlled.domain='lan'
uci set dhcp.dns_controlled.expandhosts='1'
uci set dhcp.dns_controlled.nonegcache='0'
uci set dhcp.dns_controlled.authoritative='0'
uci set dhcp.dns_controlled.readethers='1'
uci set dhcp.dns_controlled.leasefile='/tmp/dhcp.leases.controlled'
uci set dhcp.dns_controlled.resolvfile='/tmp/resolv.conf.d/resolv.conf.auto.controlled'
uci set dhcp.dns_controlled.nonwildcard='1'
uci set dhcp.dns_controlled.localservice='1'
uci set dhcp.dns_controlled.server='/#/188.8.131.52'
When I restart dnsmasq I can see from the output that it is starting 2 instances not 1. I'm not sure if that syntax for setting the upstream resolver at 184.108.40.206 is correct, because I have also seen a post where the config is applied as follows:
uci uci add_list dns_controlled.server='220.127.116.11'
uci uci add_list dns_controlled.server='18.104.22.168'
Not sure which one is correct.
Anyway, my understanding (which may be flawed) is that if I can be guaranteed my second dnsmasq instance is working as expected, I can then create a host entry which will use this specific instance to resolve dns queries, rather than the default instance. I have tried to do this as follows
uci add dhcp host
uci set dhcp.@host[-1].name='(my computer name)'
uci set dhcp.@host[-1].dns='1'
uci add_list dhcp.@host[-1].mac='(my MAC address)'
uci set dhcp.@host[-1].ip='10.0.0.93'
uci set dhcp.@host[-1].leasetime='12h'
uci set dhcp.@host[-1].instance='1'
I have no idea if this is the correct value I should be using for the "instance" option.
When I commit the uci for the host entry and restart dnsmasq, no devices on my lan can connect to the internet, so something has gone wrong.
Ultimately if I can get this to work, I plan to use a scheduled task or ad hoc script to change the instance of dnsmasq that this host points to, so immediately it uses the default upstream resolvers, rather than openDNS.
Not sure if all that makes sense, but if you have any comments on my approach, or can spot any errors in the above, I would appreciate it. Thank you very much for your help so far.