How do I edit per host DHCP options?



  • With a regular DCHP server I am able to specify per host options like router, hostname, domain name, DNS servers, etc… to override global options.  How can I do this in pFsense?



  • I'd like to do a per host option as well. In particular, assign a set of hosts to use opendns rather than my normal dns provider.

    This is so I can better manage blocked sites. Opendns has a lot of pre defined blocks for IM. I can simply check a box rather than hunt down everything manually. From meebo.com to blocking gmail chat (http://mail.google.com/support/bin/answer.py?hl=en&answer=34330).

    I'd like a certain set of clients to use 8.8.8.8 and a certain set to use 208.67.222.222 as dns servers. I highly doubt this is possible.


  • Rebel Alliance Developer Netgate

    It isn't currently possible, but it probably would not be that difficult to add to services_dhcp_edit.php by someone who knows a little about PHP and the config format of ISC-DHCPD.

    Since there are already per-host options for static IP mappings, it would just be a matter of adding some fields and logic to that page and to the code of the file that writes out the DHCP configuration file.

    I imagine if someone were to sponsor a bounty it could probably done very reasonably if there were no volunteers.



  • @jimp:

    It isn't currently possible, but it probably would not be that difficult to add to services_dhcp_edit.php by someone who knows a little about PHP and the config format of ISC-DHCPD.

    Since there are already per-host options for static IP mappings, it would just be a matter of adding some fields and logic to that page and to the code of the file that writes out the DHCP configuration file.

    I imagine if someone were to sponsor a bounty it could probably done very reasonably if there were no volunteers.

    I could probably do the PHP and DHCPD config stuff, but I think their is more to it.  The configuration has to get saved to an XML file (if I understand correctly).


  • Rebel Alliance Developer Netgate

    @tuaris:

    I could probably do the PHP and DHCPD config stuff, but I think their is more to it.  The configuration has to get saved to an XML file (if I understand correctly).

    That is all handled internally, just follow the format that the other fields use and it should be fine. It's a lot easier to get into programming this stuff than people realize :)

    The only extra bit that I didn't mention would likely be some input validation, but as those fields are already on the other screen, that functionality could be pulled from there as well.



  • @jimp:

    Since there are already per-host options for static IP mappings, it would just be a matter of adding some fields and logic to that page and to the code of the file that writes out the DHCP configuration file.

    I had not realized one could have per host options for static ips. Is this done by editing dhcpd.conf in /var/dhcpd/etc ? If so, would I simply add option option domain-name-servers 208.67.222.222 inside the brackets for the host I want to use that dns server?


  • Rebel Alliance Developer Netgate

    You cannot directly edit dhcpd.conf. It will be overwritten the next time DHCP options are sync'd from the GUI.

    As I've been saying throughout the thread, you must edit the PHP files which generate the dhcpd.conf file and teach them how to use these settings.



  • Ok, I understand.

    So when this was said:

    @jimp:

    Since there are already per-host options for static IP mappings, it would just be a matter of adding some fields and logic to that page and to the code of the file that writes out the DHCP configuration file.

    It implied that the PHP files would need to be edited anyways.


  • Rebel Alliance Developer Netgate

    Yeah, the per-host options I was talking about were the IP address, hostname, and MAC address, nothing more. However, since those are already there it shouldn't be hard to shoe-horn some more directives into that block.


Log in to reply