Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Update Hostname in DHCP Records #154

Open
ShoelaceMan opened this issue Nov 14, 2024 · 0 comments
Open

Feature Request: Update Hostname in DHCP Records #154

ShoelaceMan opened this issue Nov 14, 2024 · 0 comments

Comments

@ShoelaceMan
Copy link

ShoelaceMan commented Nov 14, 2024

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:

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:

# 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:
#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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant