Adding an "host-name" option to DHCP ACK packets

Forums Network Management Networking Adding an "host-name" option to DHCP ACK packets

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #42154

    In the hope that this will be useful to someone else. I modified the startup scripts of Zeroshell and extended the database to make the DHCP server send an “host-name” option to the clients. This reduces the amount of distributed configuration required for embedded devices connected to the network.

    Using SSH create the file /Database/etc/scripts/dhcp_configfile.patch with the following contents:

    --- dhcp_configfile.bak	2010-01-21 16:51:53.000000000 +0100
    +++ dhcp_configfile 2010-01-21 17:10:31.000000000 +0100
    @@ -116,9 +116,13 @@
    for E in $STATICS ; do
    IP=`cat $S/Statics/$E/IP`
    MAC=`cat $S/Statics/$E/MAC`
    + OPTION_HOSTNAME=`cat $S/Statics/$E/option-hostname`
    echo " host $E {"
    echo " hardware ethernet ${MAC};"
    echo " fixed-address ${IP};"
    + if [ "$OPTION_HOSTNAME" != "" ] ; then
    + echo " option host-name "${OPTION_HOSTNAME}";"
    + fi
    echo " }"
    echo "}"

    Then in “Setup->Startup/Cron->Preboot”, add the following line:

    cd /root/kerbynet.cgi/scripts
    /usr/bin/patch -p0 < /Database/etc/scripts/dhcp_configfile.patch
    cd -

    Make sure the script works properly using the “Test” button. Then restart the DHCP server either from the GUI or by running “/etc/init.d/dhcp restart”.

    To add an option for a specific host, create the corresponding file in


    You can find the ID by looking into “/var/register/system/dhcp/dhcpd.conf” for the host entry corresponding to the MAC address / IP address pair that you specified in the GUI.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.