DHCP static entry leases not registered in DNS Forwarder



  • Hi all !

    I've been doing some testing with DHCP and names resolving.
    In my configuration only the leases that are dynamicaly assigned are then registered in DNS forwarder.
    It does not register names of hosts added to DHCP static entry table.
    Does anyone else have this?

    ver. 1.0
    dp



  • Add static mappings to the dnsforwarder (as the IPs are mapped static too this should be no problem). This is a known limitation.



  • @hoba:

    Add static mappings to the dnsforwarder (as the IPs are mapped static too this should be no problem). This is a known limitation.

    Thanks for the answer.
    I know this is a posible workaround for the current release, but how will it be implement in future versions?
    I found pfsense very interesting and plan to use it in my network (120 PCs). This option and the extended alias system that you plan, would be (imo) a great improvement.

    dp.



  • We'll discuss it. Maybe autocreating aliases for statically mapped hosts would make sense too or having a tickbox per mapping.



  • @hoba:

    We'll discuss it. Maybe autocreating aliases for statically mapped hosts would make sense too or having a tickbox per mapping.

    It will make sens for sure!
    The great advantage of this would be that we can implement simple but well working and easy to manage names resolving system in networks where no other DNS services are running.

    The best solution IMO would be to add a 'host name' field in DHCP static table and autocreate DNS forwarder entry.



  • @dp:

    The best solution IMO would be to add a 'host name' field in DHCP static table and autocreate DNS forwarder entry.

    x2 on this, along with the domain field as well. If I get some free time I will look into this. Shouldn't be too hard to do. This would make life easier as I wouldn't have to maintain two separate lists.

    The other option of having a tick box would only create the dns entry and still require separate maintenance to remove it or modify. Not much improvement than adding it yourself now.



  • Alright I made some progress on this. The DHCP php pages and xml config reflect the host name addition. I figure we can use the default domain listed on the general page. It needs to be integrated into DNS still.

    Attached is the diff file. You might notice the folders are named 1.0 as this is based of the 1.0 developer release however the I diff'd the dhcp php pages from 1.0 to 1.0.1 and they are identical.

    So if anybody else wants to work on this they have a starting point. Integrating it will be the harder part.



  • You know what would solve this with only modifying only services.inc?!!

    Replacing line 112

    ddns-update-style none;

    with the following

    ddns-updates on;
    ddns-domainname "{$syscfg['domain']}";
    ddns-update-style ad-hoc;
    update-static-leases on;
    ignore client-updates;

    Instead of passing -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases to dnsmasq on line 585

    This performs the same function of updating the dns for the dhcp leases, except allows for static leases to be updated as well. Atleast dhcp and dns played together like that on my linux box.

    I need to test this out and will make a patch.

    Although this is dnsmasq and not bind so that might be a problem. Anybody know how to tell dnsmasq to allow updates from …



  • Heh go figure dnsmasq does not support dynamic dns updates. And dhcpd has no option to write static leases to the leases file. Go figure. So I'll continue working on my previous effort with adding the hostname field, etc.

    Out of curiosity why is pfSense using dhcpd when dnsmasq has a built in dhcp server? Although the answer might be that dnsmasq does not support failover. I haven't looked into that. In that case why not run a full blown bind server? Although bind is really more than we need for pfSense.



  • Alright, I got it working!!! Attached is the patch and changed files. This is for pfSense 1.0.1. Couple of limitations currently.

    • After adding dhcp static lease with a hostname you have to go to the dns forwarder page and click apply.
    • Currently this only works for static dhcp leases on the lan interface.
    • The domain name for the hostnames is the domain name on the system general page.

    I will work on finishing it tomorrow. It was actually quite simple to implement. When building the hosts file I have it loop over the static dhcp leases and see if they have an ipaddr and hostname. If so then it adds it to the file. The hosts file is whats served by dnsmasq.

    The php files go in /usr/local/www and the inc file goes in /etc/inc

    Hopefully since the changes are soo smal this can go in one of the future to the 1.0.1 release.



  • Go ahead and commit if this has no "negatives".

    Nice work!



  • @sullrich:

    Go ahead and commit if this has no "negatives".

    Nice work!

    Alright I added a checkbox to the dns forwarder page "Register DHCP static mappings in DNS forwarder".

    It works for all dhcp servers on multiple interfaces. The domain name is used from the general setup page.

    Have a few more things I need to check and I will commit this tomorrow.



  • Be sure to add to the commit..

    MFC: ASAP



  • I will get this committed. I have done testing and there should be no bugs. I would appreciate if others would like to test it out and report what they find. To install exectue the following via the webgui command prompt.

    fetch -o - "http://wgnrs.dynalias.com:81/pfsense/devel/dhcpstatic.tar.gz" | tar xfz - -C /

    If your running this on an embedded box pull up the serial console or ssh into the box. Select option 8 shell and execute the following.

    /etc/rc.conf_mount_rw
    fetch -o - "http://wgnrs.dynalias.com:81/pfsense/devel/dhcpstatic.tar.gz" | tar xfz - -C /
    /etc/rc.conf_mount_ro

    Afterwards go to the services->dns forwarder page and check "Register DHCP static mappings in DNS forwarder". Click save. Then go to the services->dhcp server page and fill in the hostnames. Apply the changes and your good to go.


Log in to reply