DNS and DnsMasq are confusing me on my Local LAN

I am using Lede SNAPSHOT r8391-162e016fed / LuCI Master (git-18.298.60696-35b543e) . It's a @Davidc502 build but I don't think it's unique to his build. Here's the question.

QUESTION: Sometimes I can access my Local devices by their machine name/network name like BackPie for my backyard Raspberry Pi that runs my chicken feeder. Other times with no changes at all on my part, suddenly I can only access BackPie as Backpie.lan and NOT BackPie at all. Other times, again seemingly randomly (although I know it isn't) I can only access BackPie at BackPie.local. This is while the .lan suffix is still configured in the DNS page.

Any ideas? Anyone? What I want to happen is my Static Leases to be available as their machine names. If they HAVE to have a suffix, I would like them to have the SAME suffix, ALL the time.

  1. I set up all my local devices (Raspberry PIs, Fire TV stick, etc) as Static Leases in the DHCP and DNS section of the OpenWRT configuration.

  2. I am using 9.9.9.9 and 8.8.8.8 as my DNS providers out in the world and bypassing my ISP DNS.

  3. I have my DNS options set very much to the default. I have included the images here.DNS1 dns2

Heres my config files DHCP:

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.auto'
	option nonwildcard '1'
	option serversfile '/tmp/adb_list.overall'
	option localservice '0'
	option expandhosts '1'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config host
	option name 'backpie'
	option dns '1'
	option mac 'DD:EE:FF:GG:HH:B2'
	option ip '192.168.1.11'
	option leasetime '7d'


and NETWORK

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0.1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option delegate '0'

config interface 'wan'
	option ifname 'eth1.2'
	option proto 'dhcp'
	option peerdns '0'
	option dns '127.0.0.1 9.9.9.9 8.8.8.8'
	option delegate '0'

config interface 'wan6'
	option ifname 'eth1.2'
	option proto 'dhcpv6'
	option auto '0'
	option reqaddress 'try'
	option reqprefix 'auto'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '1'
	option ports '0 1 2 5t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option vid '2'
	option ports '4 5t 6t'

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option vid '3'
	option ports '3 5t'

config interface 'guest'
	option proto 'static'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'
	option type 'bridge'
	option ifname 'eth0.3'
	option delegate '0'

and the dynamically created DNSMASQ off of my /tmp

# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
dhcp-authoritative
domain-needed
localise-queries
read-ethers
enable-ubus
expand-hosts
bind-dynamic
domain=lan
server=/lan/
dhcp-leasefile=/tmp/dhcp.leases
servers-file=/tmp/adb_list.overall
resolv-file=/tmp/resolv.conf.auto
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq

dhcp-host=DD:EE:FF:GG:HH:F2,192.168.1.11,backpie,7d

dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf


bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
dhcp-range=set:lan,192.168.1.100,192.168.1.249,255.255.255.0,12h
no-dhcp-interface=eth1.2
dhcp-range=set:guest,10.0.0.100,10.0.0.149,255.255.255.0,1h



OpenWRT is fantastic. I appreciate the work everyone puts into it. Thanks to all of you.

1 Like

Why do you have 127.0.0.1 as a WAN DNS server?

You must use a FQDN. Continue to use BackPie.lan (or .local, as you have configured) for your DNS resolution to work.

@lleachii, I have 127.0.0.1 in the list so that DNS always hits dnsmasq first. Is that not required? It was mentioned in a post about setting up dnsmasq as caching DNS server.

I haven't configured it to do either .local or .lan. I suppose that was part of my question. I see mention of the .lan suffix in the DNS setup screen. Where do you see the .local option configured?

I don't see a .local, you mentioned it. I said:

My point - you need a FQDN for your resolution purpose, I don't care which one you use.

Your LAN config appears set to use dnsmasq...(and obviously, as such) it's your only DNS server. It's not required. In addition, setting it for WAN likely doesn't give you the desired effect anyways. I've only seen that 127.0.0.1 config on a desktop, and you don't self-reference dnsmasq as you have.