Dnsmasq alternate db file



  • Doing some per interface instance dnsmasq and dhcpleases to support the dhcp server interface specific specified domain option.  Pretty much have it working but lack one critical piece.  Cannot seem to get dnsmasq to use a specified leases db file, such as dhcp.leases.de0 instead of the default dhcp.leases.

    The dhcp-leasefile option does not seem to work.

    Have come across some info that the dhcp-leasefile option is depreciated and will be removed in a future release.  Just guessing that is why it doesn’t work.  Although the option does still exist and does not throw an error or warning.

    Is there a way to make dnsmasq use an alternate db file?


  • Rebel Alliance Developer Netgate

    We don't use dnsmasq for DHCP, and it no longer reads the DHCP leases file directly. The dhcpleases daemon watches the leases file in /var/dhcpd/var/db/ and then writes the changes directly to /etc/hosts



  • @jimp:

    We don't use dnsmasq for DHCP, …

    That doesn't seem to jive with what I see in /etc/inc/services.inc.

    @jimp:

    … and it no longer reads the DHCP leases file directly.

    But what writes the DHCP leases file?  That is what I must be missing.

    @jimp:

    The dhcpleases daemon watches the leases file in /var/dhcpd/var/db/ and then writes the changes directly to /etc/hosts

    Yes this I'm aware of and am able to direct interface specific instances of the dhcpleases daemon to an interface specific dhcp.leasees.x db.  That part works fine.

    What I'm trying to do is create interface specific dhcp.leases db's.  How do I do that?
    Code in /ect/inc/services.inc seems to be using dnsmasq.
    If dnsmasq is not being used, then what?


  • Rebel Alliance Developer Netgate

    What exactly are you referring to in services.inc that's associating dnsmasq with dhcp?



  • @NOYB:

    If dnsmasq is not being used, then what?

    dhcpd



  • ~ line 1460 in function services_dnsmasq_configure()

    /* run dnsmasq */

    mwexec_bg("/usr/local/sbin/dnsmasq –local-ttl 1 --all-servers {$dns_rebind} --dns-forward-max=5000 --cache-size=10000 {$args}");

    Is this only used for dns then and dhcpd for dhcp?

    Guess I need to be looking at dhcpd instead.

    Thanks,

    What I'm aiming for is to have dhcp clients registered in dns forwarder (hosts file) with the domain name specified in the dhcp services for each interface.

    Any other tips for going about this?


  • Rebel Alliance Developer Netgate

    dnsmasq is for DNS only, isc-dhcpd is for dhcp leasing.

    The dhcpleases daemon (in the tools repo, in pfPorts) is what monitors the leases file. It reads the data from there, and writes the entries to /etc/hosts.

    dnsmasq then reads /etc/hosts to provide the DNS responses to clients.

    I'd guess that dchpleases would need to be taught about the domains if it isn't smart enough to handle them already.



  • @jimp:

    dnsmasq is for DNS only, isc-dhcpd is for dhcp leasing.

    The dhcpleases daemon (in the tools repo, in pfPorts) is what monitors the leases file. It reads the data from there, and writes the entries to /etc/hosts.

    dnsmasq then reads /etc/hosts to provide the DNS responses to clients.

    I'd guess that dchpleases would need to be taught about the domains if it isn't smart enough to handle them already.

    Already have multiple interface specific instances of dhcpleases running and using reading interface specific dhcp leases "db's" and adding the clients in hosts file with the dhcp service specified domain name for that interface.

    Think I just need to get dhcpd to operate on an interface specific basis (interface specific dhcp leases "db's")
    Is there a better way to do this?  For instance without running multiple instances of dhcpleases and dhcpd.

    Thanks


  • Rebel Alliance Developer Netgate

    I'm not sure it can/will do that.

    Probably dnsmasq needs to know in a single instance what domain name belongs with what range of IPs and match them up as it goes.



  • That gets complicated quickly with single instance of dnsmasq.
    Your only choice is multiple dnsmasq instances and keep track of them.


Locked