Issue with dnsmasq multiples instances

Hello, I recently installed Openwrt on a Xiaomi Mi 3G router
I have created 2 dnsmasq instances in 2 different vlans. Both looks to be working fine and are responding request from its subnet.

root@X-WRT:~# netstat -tlpn|grep dns
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      10371/dnsmasq
tcp        0      0 192.168.16.1:53         0.0.0.0:*               LISTEN      10371/dnsmasq
tcp        0      0 192.168.15.1:53         0.0.0.0:*               LISTEN      10370/dnsmasq

I want to access one of the instances from a machine in the other subnet, but dnsmasq is not answering. Routing is ok and I can ping the ip.
I tried with the option localservice '0' in /etc/config/dhcp but same result.
Here is my dnsmasq instance config:

config dnsmasq 'lan_dns2'
        option authoritative '1'
        option readethers '1'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option ednspacket_max '1232'
        option cachesize '2048'
        option dnsforwardmax '2048'
        option localservice '0'
        option rebind_protection '1'
        option nonwildcard '1'
        option local '/lan2_dns/'
        option domain 'lan2_dns'
        option leasefile '/tmp/dhcp_lan2_dns.leases'
        option confdir '/tmp/dnsmasq_lan2.d'
        list interface 'lan2'
        list notinterface 'lan'
        list interface 'loopback'

I already tried to create a snat rule, so the request from 192.168.15.XX are translated with a ip in the 192.168.16, but same result.

What am I doing wrong?
Thanks a lot

uci show firewall; iptables-save -c | grep '53'
2 Likes
root@X-WRT:~# uci show firewall
firewall.@defaults[0]=defaults
firewall.@defaults[0].syn_flood='1'
firewall.@defaults[0].input='ACCEPT'
firewall.@defaults[0].output='ACCEPT'
firewall.@defaults[0].forward='REJECT'
firewall.@zone[0]=zone
firewall.@zone[0].name='lan'
firewall.@zone[0].input='ACCEPT'
firewall.@zone[0].output='ACCEPT'
firewall.@zone[0].forward='ACCEPT'
firewall.@zone[0].mtu_fix='1'
firewall.@zone[0].network='lan lan2'
firewall.@zone[1]=zone
firewall.@zone[1].name='wan'
firewall.@zone[1].input='REJECT'
firewall.@zone[1].output='ACCEPT'
firewall.@zone[1].forward='REJECT'
firewall.@zone[1].masq='1'
firewall.@zone[1].mtu_fix='1'
firewall.@zone[1].network='wan'
firewall.@forwarding[0]=forwarding
firewall.@forwarding[0].src='lan'
firewall.@forwarding[0].dest='wan'
firewall.@rule[0]=rule
firewall.@rule[0].name='Allow-DHCP-Renew'
firewall.@rule[0].src='wan'
firewall.@rule[0].proto='udp'
firewall.@rule[0].dest_port='68'
firewall.@rule[0].target='ACCEPT'
firewall.@rule[0].family='ipv4'
firewall.@rule[1]=rule
firewall.@rule[1].name='Allow-Ping'
firewall.@rule[1].src='wan'
firewall.@rule[1].proto='icmp'
firewall.@rule[1].icmp_type='echo-request'
firewall.@rule[1].family='ipv4'
firewall.@rule[1].target='ACCEPT'
firewall.@rule[2]=rule
firewall.@rule[2].name='Allow-IGMP'
firewall.@rule[2].src='wan'
firewall.@rule[2].proto='igmp'
firewall.@rule[2].family='ipv4'
firewall.@rule[2].target='ACCEPT'
firewall.@rule[3]=rule
firewall.@rule[3].name='Allow-DHCPv6'
firewall.@rule[3].src='wan'
firewall.@rule[3].proto='udp'
firewall.@rule[3].src_ip='fc00::/6'
firewall.@rule[3].dest_ip='fc00::/6'
firewall.@rule[3].dest_port='546'
firewall.@rule[3].family='ipv6'
firewall.@rule[3].target='ACCEPT'
firewall.@rule[4]=rule
firewall.@rule[4].name='Allow-MLD'
firewall.@rule[4].src='wan'
firewall.@rule[4].proto='icmp'
firewall.@rule[4].src_ip='fe80::/10'
firewall.@rule[4].icmp_type='130/0' '131/0' '132/0' '143/0'
firewall.@rule[4].family='ipv6'
firewall.@rule[4].target='ACCEPT'
firewall.@rule[5]=rule
firewall.@rule[5].name='Allow-ICMPv6-Input'
firewall.@rule[5].src='wan'
firewall.@rule[5].proto='icmp'
firewall.@rule[5].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type' 'router-solicitation' 'neighbour-solicitation' 'router-advertisement' 'neighbour-advertisement'
firewall.@rule[5].limit='1000/sec'
firewall.@rule[5].family='ipv6'
firewall.@rule[5].target='ACCEPT'
firewall.@rule[6]=rule
firewall.@rule[6].name='Allow-ICMPv6-Forward'
firewall.@rule[6].src='wan'
firewall.@rule[6].dest='*'
firewall.@rule[6].proto='icmp'
firewall.@rule[6].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type'
firewall.@rule[6].limit='1000/sec'
firewall.@rule[6].family='ipv6'
firewall.@rule[6].target='ACCEPT'
firewall.@rule[7]=rule
firewall.@rule[7].name='Allow-IPSec-ESP'
firewall.@rule[7].src='wan'
firewall.@rule[7].dest='lan'
firewall.@rule[7].proto='esp'
firewall.@rule[7].target='ACCEPT'
firewall.@rule[8]=rule
firewall.@rule[8].name='Allow-ISAKMP'
firewall.@rule[8].src='wan'
firewall.@rule[8].dest='lan'
firewall.@rule[8].dest_port='500'
firewall.@rule[8].proto='udp'
firewall.@rule[8].target='ACCEPT'
firewall.@rule[9]=rule
firewall.@rule[9].name='Support-UDP-Traceroute'
firewall.@rule[9].src='wan'
firewall.@rule[9].dest_port='33434:33689'
firewall.@rule[9].proto='udp'
firewall.@rule[9].family='ipv4'
firewall.@rule[9].target='REJECT'
firewall.@rule[9].enabled='false'
firewall.@include[0]=include
firewall.@include[0].path='/etc/firewall.user'
firewall.natcapd=include
firewall.natcapd.type='script'
firewall.natcapd.path='/usr/share/natcapd/firewall.include'
firewall.natcapd.family='any'
firewall.natcapd.reload='1'
firewall.miniupnpd=include
firewall.miniupnpd.type='script'
firewall.miniupnpd.path='/usr/share/miniupnpd/firewall.include'
firewall.miniupnpd.family='any'
firewall.miniupnpd.reload='1'
firewall.mwan3=include
firewall.mwan3.type='script'
firewall.mwan3.path='/usr/share/mwan3/mwan3-reload.sh'
firewall.mwan3.reload='0'
root@X-WRT:~# 
root@X-WRT:~# 
root@X-WRT:~# iptables-save -c | grep '53'
root@X-WRT:~#

https://github.com/x-wrt/x-wrt/issues

uci -q set dhcp.@dnsmasq[0].nonwildcard='0'; uci commit dhcp
echo 'bind-interfaces' >> /etc/dnsmasq.conf; /etc/init.d/dnsmasq restart
3 Likes

thanks for your (very) quick answer.
I got an error starting the second instance:

Fri Jan  8 15:58:39 2021 daemon.crit dnsmasq[6862]: cannot set --bind-interfaces and --bind-dynamic
Fri Jan  8 15:58:39 2021 daemon.crit dnsmasq[6862]: FAILED to start up


so I changed to option nonwildcard '0' also in the other instance and now it is working!!.

Thanks a lot!

My config if someone has a similar issue:

root@X-WRT:~# cat /etc/config/dhcp 

config dnsmasq 'lan_dns'
	option domainneeded '1'
	option localise_queries '1'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option ednspacket_max '1232'
	option cachesize '2048'
	option dnsforwardmax '2048'
	option localservice '1'
	option rebind_protection '1'
	list notinterface 'lan2'
	list notinterface 'loopback'
	list interface 'lan'
	option local '/lan_dns/'
	option domain 'lan/dns'
	option leasefile '/tmp/dhcp_lan_dns.leases'
	option nonwildcard '0'
	option confdir '/tmp/dnsmasq.d'

config dnsmasq 'lan_dns2'
	option authoritative '1'
	option readethers '1'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option ednspacket_max '1232'
	option cachesize '2048'
	option dnsforwardmax '2048'
	option localservice '0'
	option rebind_protection '1'
	option nonwildcard '0'
	option local '/lan2_dns/'
	option domain 'lan2_dns'
	option leasefile '/tmp/dhcp_lan2_dns.leases'
	option confdir '/tmp/dnsmasq_lan2.d'
	list interface 'lan2'
	list interface 'loopback'
	list notinterface 'lan'

And

echo 'bind-interfaces' >> /etc/dnsmasq.conf;

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.