What's new

Weird DNS issue on 384.9

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

sbsnb

Very Senior Member
I have been using this setup through numerous versions of Merlin without issue, but after the upgrade to 384.9 I'm having issues resolving only *some* local machines. I have a slew of static DHCP assignments set up in /jffs/configs/dnsmasq.conf.add. For example:

Code:
dhcp-host=DE:AD:BE:EF:CA:FE,foo,192.168.1.2,12h
dhcp-host=DE:AD:BE:EF:CA:FF,bar,192.168.1.3,12h

I get this:

Code:
admin@RT-AC88U:/tmp/home/root# nslookup foo
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost.localdomain

nslookup: can't resolve 'foo'

Code:
admin@RT-AC88U:/tmp/home/root# nslookup bar
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost.localdomain

Name:      bar
Address 1: 192.168.1.3 bar.test.lan

This sounds like the issue people have with DNS filtering, but this is only happening to one or two hosts (depending on the time). All the rest of the hosts work as expected and have nothing obvious in common. I've tried restarting dnsmasq to no effect.

Any ideas appreciated.
 
Edit the resultant config file with vi and look for any missing or corrupted lines.
Code:
vi /etc/dnsmasq.conf
 
Yes.

Code:
C:\Users\me>nslookup bar
Server:  router.asus.com
Address:  192.168.1.1

*** router.asus.com can't find bar.test.lan: Non-existent domain
 
What's even weirder is that I can ping the machine by IP, but it doesn't show up in the System Log -> DHCP leases tab. It obviously has a lease or it wouldn't be working since it's configured for DHCP and has the address it was assigned by the dnsmasq config.

PS - Where the router.asus.com coming from?
 
but it doesn't show up in the System Log -> DHCP leases tab. It obviously has a lease or it wouldn't be working since it's configured for DHCP and has the address it was assigned by the dnsmasq config.
OK I think I've got it. Just because you have dhcp-host entries in your config file doesn't mean it will resolve the names. For that you need for dnsmasq to have issued a lease. Try power cycling bar to force it to reacquire its lease and see what happens. I suspect that bar hasn't reacquired its lease since you've rebooted the router.
 
Last edited:
I'll try that, but I have to wait because it's in the middle of a task. How does it end up with an IP address without obtaining a lease?
 
Forcing the client to renew DHCP fixed the issue, but I'm still left wondering how this edge case came about. How do you get assigned an IP and then have the DHCP server "forget" the lease in a way that doesn't force renewal?
 
I have only had my router for a couple of firmware releases. I initially created the static DHCP list in the GUI. I have since updated it from the command line.
The static DHCP entries are stored in nvram variable dhcp_staticlist with fields MAC, IP and hostname.
These entries are added to dnsmasq.conf as dhcp-host entries with fields MAC and IP address only. This is inconsistent with the format you are using.
I am able to nslookup all of my static DHCP hosts. The only hosts I cannot nslookup are dynamic DHCP IoT devices which only wake up once a day or when used.
The dnsmasq man page suggests to me that you have reversed the IP and hostname fields:
Code:
-G, --dhcp-host=[<hwaddr>][,id:<client_id>|*][,set:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]
Specify per host parameters for the DHCP server. This allows a machine with a particular hardware address to be always allocated the same hostname, IP address and lease time. A hostname specified like this overrides any supplied by the DHCP client on the machine. It is also allowable to omit the hardware address and include the hostname, in which case the IP address and lease times will apply to any machine claiming that name. For example --dhcp-host=00:20:e0:3b:13:af,wap,infinite tells dnsmasq to give the machine with hardware address 00:20:e0:3b:13:af the name wap, and an infinite DHCP lease. --dhcp-host=lap,192.168.0.199 tells dnsmasq to always allocate the machine lap the IP address 192.168.0.199.
 
Last edited:
I'll try that, but I have to wait because it's in the middle of a task. How does it end up with an IP address without obtaining a lease?
It depends on your particular situation, and how the client is designed. But the client has no reason to reacquire it's lease until the time is due. However, it will do so if it is rebooted (obviously) or if its network interface goes down.

The later would be the case if the client is connected directly to the router when it is rebooted. But if the router is not rebooted or the client is not directly attached (i.e. it's connected to an intermediate switch) then the client is unaware of any changes to the router and will carry on using its current IP address.
 
The static DHCP entries are stored in nvram variable dhcp_staticlist with fields MAC, IP and hostname.
These entries are added to dnsmasq.conf as dhcp-host entries with fields MAC and IP address only. This is inconsistent with the format you are using.
Using dnsmasq to define the static hosts is easier to manage and removes any limit on the number of configured static hosts.
 
Client was probably still using a pre-existing lease that hadn't expired yet, so it hadn't requested a new lease with the new hostname.
 
It's been the same config for years. Something happened that caused dnsmasq to "forget" the lease. Maybe something as simple as restarting dnsmasq. I would have thought doing so wouldn't have triggered that chain of events, but maybe so.
 
The leases won't be remembered after a reboot because they're held in tmpfs (/var/lib/misc/dnsmasq.leases). But just restarting dnsmasq should be OK because it can carry on using that file. Without knowing exactly what you did it's difficult to speculate further.
 
Or you can use some thing like
Code:
addn-hosts=/jffs/etc/dnsmasq.d/dnsmasq.hosts
in dnsmasq.conf.add
Example of dnsmasq.hosts is
Code:
192.168.1.2 foo.somewhere.net foo

P.S. Edited, thanks to ColinTaylor
 
Last edited:
Or you can use some thing like
Code:
dhcp-hostsfile=/jffs/etc/dnsmasq.d/dnsmasq.dhcp.hosts
in dnsmasq.conf.add
Example of dnsmasq.dhcp.hosts is
Code:
192.168.1.2 foo.somewhere.net foo
This won't work. You seem to be confusing two different things. (Maybe you were thinking of the --addn-hosts parameter.)

The contents of your dnsmasq.dhcp.hosts file is that of a normal hosts file, not that of the dhcp-hostsfile.

Even if you put the correct information in that file it still doesn't solve the original problem. All you have done is move the entries from dnsmasq.conf.add to dnsmasq.dhcp.hosts. The effect is unchanged.
 
This won't work. You seem to be confusing two different things. (Maybe you were thinking of the --addn-hosts parameter.)

The contents of your dnsmasq.dhcp.hosts file is that of a normal hosts file, not that of the dhcp-hostsfile.

Even if you put the correct information in that file it still doesn't solve the original problem. All you have done is move the entries from dnsmasq.conf.add to dnsmasq.dhcp.hosts. The effect is unchanged.
Yes, about names - it's my mistake.
Code:
addn-hosts=/jffs/etc/dnsmasq.d/dnsmasq.hosts
And it will solve the issue, when dhcp-lease for exact hosts didn't provided, by some reasons. The nslookup will return the right name, due to dnsmasq will know the pair Ip and dns independently from the lease status ...

P.S. And yes - it required to put record each host in twice - as for dhcp, as for dns resloving. It's not optimal, but ...
 
Code:
addn-hosts=/jffs/etc/dnsmasq.d/dnsmasq.hosts
And it will solve the issue, when dhcp-lease for exact hosts didn't provided, by some reasons. The nslookup will return the right name, due to dnsmasq will know the pair Ip and dns independently from the lease status ...
There's no need to do it this way in Merlin's firmware because there's already a custom config file available for this purpose, /jffs/configs/hosts.add.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top