Modify

Opened 7 years ago

Last modified 6 years ago

#1179 investigate enhancement

Add static leases to /etc/hosts for DnsMasq

Reported by: Jon "The Nice Guy" Spriggs <jon@…> Owned by:
Priority: normal Milestone: Firmware 2.3
Component: fon-network Version: N/A
Severity: unknown
Cc: Hardware: both

Description

It would be useful to be able to step through luci_ethers.@static_lease[] and add entries to /etc/hosts for each of the .hostname, mapping them to the .ipaddr.

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by matthijs

  • Hardware changed from unknown to both
  • Milestone set to Firmware 2.3
  • Status changed from new to confirmed
  • Version set to N/A

Yup, that would be useful indeed. I wonder if dnsmasq doesn't support something like this built-in, though, since it is both the DNS and DHCP server. Perhaps some flag is needed to enable this, or perhaps the hostnames are not communicated to dnsmasq now (haven't checked).

Or, doesn't this already work? Just tried a ping here, which seems to work:

matthijs@grubby:~$ ping tika
PING tika.lan (192.168.1.240) 56(84) bytes of data.

The .lan is the search domain configured by the Fonera through DHCP, which seems to make this work?

Doesn't this work for you?

comment:2 Changed 6 years ago by matthijs

  • Status changed from confirmed to infoneeded

*bump*

comment:3 Changed 6 years ago by Jon "The Nice Guy" Spriggs <jon@…>

Oops, sorry, completely forgot about this! As you can tell it's desperately urgent :)

So, the issue occurs when you reboot the FON device, and before the device next performs a DHCP renew.

So, if you've got device1.lan 192.168.1.5, reboot the FON device, and then try to ping device1.lan, your computer will try to do the DNS resolve against the FON spot, and it will not resolve.

If you then connect to device1, and force a DHCP renew, it will register it with the DNSMasq, and will then resolve.

Where this is most annoying is where you allocate a DHCP reservation on the FON device (to ensure it doesn't get allocated) and then set the device to be statically allocated... then you've got no way to force DNSMasq to do DNS responses for that device.

DNSMasq will parse /etc/hosts in it's current config, so you could add the IP addresses to /etc/hosts, but that seems to be re-created on reboot?

comment:4 Changed 6 years ago by matthijs

  • Status changed from infoneeded to investigate

Ah, indeed.

For the reboot case, it might be sufficient to make sure dnsmasq's lease file becomes persistent (e.g., store in in /etc/ or something).

For the statically allocated case, dnsmasq would need to resolve hosts from its static list instead of just the actual leases list, but I doubt this is supported (and I'm reluctant to patch it in).

In any case, since these are corner cases to some degree and requires some non-trival change, I won't be trying to fix this before 2.3.7.0.

Add Comment

Modify Ticket

Action
as investigate The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.