dhcpcd-discuss

Re: Customizing DHCP options in script

Roy Marples

Wed Jun 27 13:17:39 2018

Hi Thomas

On 27/06/2018 11:45, HAMMERMÜLLER Thomas wrote:
I´m using dhcpcd on the Raspberry Pi and it works pretty good.

Now I would like to send some information from the client to a DHCP server via the DHCP options. For this, I use option 60, vendor class id, and option 43, vendor specific information. If I configure both options in the dhcpcd.conf it works also pretty good.

Now my question is, if it is possible to customize both options in the run hook e.g. PREINIT?

Background is that the content of both options should depend on some hardware switches on the device. I would need this to be able to distinguish between the devices at the DHCP server.

No, this is currently not possible.
Provided the hardware switches don't change during runtime you would be best placed to generate dhcpcd.conf using something like sed or awk to create one from a template and fill in the values before starting dhcpcd.

Now, if the switches do change during runtime, you could hook this into an acpi event maybe (if the platform supports it) to regen dhcpcd.conf. You could then call `dhcpcd -n` to force dhcpcd to reload config and rebind addresses.

Roy

References:
Customizing DHCP options in scriptHAMMERMÜLLER Thomas
Archive administrator: postmaster@marples.name