What's new

minor question: why doesn't hosts.dnsmasq.add work?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ayounggun

New Around Here
Hi all

My thanks to Merlin. My donation seemed a bit small when I looked over at the donation thread. I hope this doesn't come across poorly! :)

I wanted dnsmasq to resolve some names on my network, so I added them to /etc/hosts.dnsmasq, which seemed like the most appropriate place given the addn-hosts=/etc/hosts.dnsmasq line in /etc/dnsmasq.conf.

To prevent the changes from being lost, I created the file /jffs/configs/hosts.dnsmasq.add but on reboot the I lost my changes unfortunately. Dnsmasq picks up on /etc/hosts too however, so I made an /jffs/configs/hosts.add instead which works fine.

I wasn't sure if this was expected behaviour or a bug, so wanted to check here.

I have nginx on my raspberry pi proxying requests sent from the router which is handy because I can type nzbget.mydomain.com rather than the ugly ip + port. Slightly neurotic but I learnt something :).

If anyone's interested here's the code I used:

Code:
server {
    server_name nzbget.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:6789;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Thanks
 
hosts.dnsmasq.add is not a valid file, but hosts.add is.

https://github.com/RMerl/asuswrt-merlin/wiki/Custom-config-files

hosts.dnsmasq is created from the LAN > DHCP Server > "Manually Assigned IP around the DHCP list".

So you can either use hosts.add (as you already have) or use the GUI to create a reserved IP address for your hosts. Note that even if your hosts don't use DHCP you can still create a reservation for them in DHCP (you don't even need to put in a valid MAC address!). The advantage of this is that it's easier to maintain than editing the hosts.add file and it also stops DHCP from giving the IP address to someone else.
 
Hi Colin

Thanks very much - sorry I didn't realise that the list was exclusive, which was my fault for not reading carefully!

Thanks for the other tips about DHCP reserving the ip addresses. Also I never noticed the name field before on the LAN > DHCP Server.

I think I will have to stick with hosts.add for the most part because I have a few different names (e.g. sickbeard and nzbget) mapping to the same local ip (my raspberry pi). It doesn't sound like I'm doing anything too improperly so I'm happy.

Thanks :)
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top