static leases conflict with /etc/hosts

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking
Author Message
johnnyNobody999
DD-WRT User


Joined: 10 Jan 2014
Posts: 277

PostPosted: Fri Feb 14, 2020 18:20    Post subject: static leases conflict with /etc/hosts Reply with quote
Why doesn't static leases in Services->Static Leases overwrite corresponding entries in the /etc/hosts file? I made changes to my static leases but now I get many of these syslog entries for devices that had their static address changed:

Feb 14 10:13:35 wrt3200acm_master daemon.warn dnsmasq-dhcp[26148]: not giving name <redacted> to the DHCP lease of #.#.aa.x because the name exists in /etc/hosts with address #.#.aa.y

WRT3200ACM firmware r42335
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 601

PostPosted: Fri Feb 14, 2020 19:01    Post subject: Reply with quote
Those leases go to the dhcp server, which does not have to use the hosts file. THe hosts file is for the operating system and programs if they choose to use it. Then you have dns that can uses the hosts file as well as its own database.
johnnyNobody999
DD-WRT User


Joined: 10 Jan 2014
Posts: 277

PostPosted: Sat Feb 15, 2020 1:01    Post subject: Reply with quote
From what I've found it seems that editing /etc/hosts is not an easy task. The wiki says to create a startup script so that the changes are "permanent".
d0ug
DD-WRT Guru


Joined: 31 Jul 2015
Posts: 817

PostPosted: Sat Feb 15, 2020 2:48    Post subject: Reply with quote
If your router has jffs storage or supports usb, you can use commands like this added to your startup script to mount files over top of the read only files. I do this to put my own ssl certs in the router. As far as I remember you can't use ln to simlink over the files because the file system is RO.

#####Mount SSL Certs
mount -o bind /jffs/certs/cert.pem /etc/cert.pem
mount -o bind /jffs/certs/host.pem /etc/host.pem
mount -o bind /jffs/certs/key.pem /etc/key.pem
stopservice httpd
startservice httpd
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum