[Dnsmasq-discuss] dnsmasq command to add dhcp-host record?

Geert Stappers stappers at stappers.nl
Sun Jan 3 20:46:51 GMT 2021


On Sun, Jan 03, 2021 at 09:03:57PM +0100, Jelle de Jong wrote:
> Hello everybody,

Happy New Year,


 
> What is a good way to dynamically add a dhcp-host record, so a machine will
> get the ipaddr I assign to it?
> 
> example:
> dhcp-host=52:54:00:e6:f4:8a,192.168.40.29,nginx01.example.lan,infinite
> 
> I want to automate the process and be able to integrate it with my ansible
> deployment systems.
> 
> Adding the line to the dnsmasq config file and reloading it will do the
> trick but is there a way to dynamically add it with some dnsmasq command?
> 
> Tips?

Quoting the manual page

 --dhcp-hostsdir=<path>
        This is equivalent to --dhcp-hostsfile, except for the following. The path MUST  be
        a  directory, and not an individual file. Changed or new files within the directory
        are read automatically, without the need to send SIGHUP.  If a file is  deleted  or
        changed  after  it has been read by dnsmasq, then the host record it contained will
        remain until dnsmasq receives a SIGHUP, or is restarted; ie host records  are  only
        added dynamically.



Beste wensen
Groeten Stappers



More information about the Dnsmasq-discuss mailing list