#154·NanoKVM

Feature Request: Update Hostname in DHCP Records

Author: ShoelaceManCreated Nov 14, 2024Updated Sep 19, 2026

First off, thank you for creating the NanoKVM—it's a fantastic product!

I've noticed that the NanoKVM doesn’t update its hostname in DHCP after obtaining an address, which would be a helpful feature, especially in network environments where hostname tracking is essential.

The device uses udhcpc as the DHCP client, which includes an option (-F) for updating the hostname in the DHCP server's records. Here is a command that successfully achieves this:

bash
udhcpc -i eth0 -t 3 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid -F ${HOSTNAME}

Currently, udhcpc runs with these options: -i eth0 -t 3 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid

But I tested and noted that it works as expected with the additional -F ${HOSTNAME} flags:

bash
# ps aux | grep [d]hcpc
868 root     udhcpc -i eth0 -t 3 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid -F kvm-b6c9

By setting the -F ${HOSTNAME} flag dynamically, the device will automatically update its hostname in the DHCP records, improving its integration in network environments without needing further configuration.

Suggested Implementation: Please consider adding -F ${HOSTNAME} to the udhcpc command in the initialization files for NanoKVM. This should allow each device to reflect its hostname in the DHCP server. Here are some examples that apply the changes, which I've deployed on all of my NanoKVM's: sed -i 's#(udhcpc -i eth0 -t 10 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid)#(udhcpc -i eth0 -t 10 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid -F ${HOSTNAME})#' /etc/init.d/S30eth sed -i 's#udhcpc -i eth0 -t 3 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid#udhcpc -i eth0 -t 3 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid -F ${HOSTNAME}#' /etc/init.d/S30eth

Now, if this gets implemented, it might be a good time to look at this feature request as well: https://github.com/sipeed/NanoKVM/issues/144

Which seems to be as simple as echoing the inputted hostname to /boot/hostname

Thanks again for your attention to this request, and please let me know if I can provide further details!