gargoyle
gargoyle copied to clipboard
Manual changes to /etc/hosts are reverted on DHCP > Save Changes
Steps to reproduce issue:
- manually edit the /etc/hosts file via ssh.
- Via web front end Connection > DHCP > Save Changes
- manual changes to /etc/hosts are reverted
The createHostCommands variable should be removed completely, since DHCP configuration no longer lives in /etc/hosts there is no need to revert this file to factory setting.
https://github.com/ericpaulbishop/gargoyle/blob/ae547ce5113ce1c6e260112bcdcab9f41e3e7ab8/package/gargoyle/files/www/js/dhcp.js#L105
Thanks for reporting, I will consider a fix. We do place local host information in there intentionally so there is still a requirement.
Perhaps rather than clearing the file, it could append the localhost lines only if they are are missing.
Is there anyway to add hosts to the /etc/hosts file, or otherwise add hosts to be served up via DNS, without knowing a device mac as the UI requires?
Through the GUI? No. OpenWrt under the hood allows a match based on other means (e.g. hostname only).
The purpose with Gargoye of course being to lock down the devices to known addresses so we can then apply other policies (quotas, QoS and restrictions).
but if I were to use a non-gui way of adding a hostname/ip mapping as via /etc/hosts or some other means like uci, that mapping would be overwritten when (for example) adding a new host/address/mac via the gui?
On October 19, 2025 12:25:15 PM EDT, Michael @.***> wrote:
lantis1008 left a comment (ericpaulbishop/gargoyle#1009)
Through the GUI? No. OpenWrt under the hood allows a match based on other means (e.g. hostname only).
The purpose with Gargoye of course being to lock down the devices to known addresses so we can then apply other policies (quotas, QoS and restrictions).
-- Reply to this email directly or view it on GitHub: https://github.com/ericpaulbishop/gargoyle/issues/1009#issuecomment-3419783372 You are receiving this because you commented.
Message ID: @.***>
That is correct by the current logic. It removes /etc/ethers and /etc/hosts on save. It also removes all sections of type “host” in /etc/config/dhcp and recreates from the GUI.
It was not designed to be modified otherwise. It could be changed to leave the other files alone if needed, but the change to config is probably needed.
thanks for your incredibly prompt reply.
I would find that change to be most welcome. It's rather core linux networking funcrionality that a lot of routers provide, though it makes sense if the makers of Gargoyle consider it out-of-scope. However, a small concession (some way to add to /etc/hosts and /etc/ethers) would be very much appreciated.
For now, for my needs, I can write a script that detects if the needed lines are missing from /etc/hosts, and if so, appends them (restarting dnsmasq if needed). But, it's a pretty hacky solution, and it'd be nice to have a more clean alternative.