What's new

How to best create local dns entries for static IP hosts?

  • 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!

5mall5nail5

Regular Contributor
Hey guys - I added entries to /etc/hosts on my AC66u with Merlin firmware, but at reboot it lost the changes.

Is there a better way to preserve DNS entries for internal hosts?

Thanks,
Jon
 
Hey guys - I added entries to /etc/hosts on my AC66u with Merlin firmware, but at reboot it lost the changes.

Is there a better way to preserve DNS entries for internal hosts?

Thanks,
Jon

Put the entries in a hosts.add file on /jffs/configs. This will add those entries to the hosts file on reboot.
 
some of the community scripts rely on hosts.add and may overwrite it, i think it would be better practice to use dnsmasq.conf.add with;

addn-hosts=/jffs/extrahostsfile

and make your own additions there
 
some of the community scripts rely on hosts.add and may overwrite it, i think it would be better practice to use dnsmasq.conf.add with;

addn-hosts=/jffs/extrahostsfile

and make your own additions there

Ok I think I got it working.

Only drag is I don't see the name resolve under the "clients" link on Network Map.

Anyway to remedy that?
 
Sounds like your very best option would be to forget everything above and set static DHCP reservations in the webui with host names. The host names will be pushed to the clients with the DHCP information and dnsmasq will respond to the host names for lookups.
 
Sounds like your very best option would be to forget everything above and set static DHCP reservations in the webui with host names. The host names will be pushed to the clients with the DHCP information and dnsmasq will respond to the host names for lookups.

So I'd need to extend my DHCP scope down to where my static hosts are though, yeah? Right now I have my scope start at 192.168.50.100 and my static IPs are from 192.168.50.1 - 53 (with some gaps, but I definitely have about 12 - 15 static IPs). Would I want to set the reservation first? Can I even do that? I don't want to risk other clients getting the IPs I want to hold.
 
So I'd need to extend my DHCP scope down to where my static hosts are though, yeah? Right now I have my scope start at 192.168.50.100 and my static IPs are from 192.168.50.1 - 53 (with some gaps, but I definitely have about 12 - 15 static IPs). Would I want to set the reservation first? Can I even do that? I don't want to risk other clients getting the IPs I want to hold.

No need to extend the range. My DHCP is 10.10.10.100-254 but my statics are below 100.
 
Static DHCP reservations. Six of one, half dozen of the other. Or as Asus calls it, "Manually Assigned IP around the DHCP list".

Ok, I am cool with that, I am just used to setting reservations within the scope in DHCP.

Thanks!
 
Ok so that works well, I have hostname resolution but I have some ordinary DHCP clients that only show up as MAC. For instance, my ipad shows up by its name but my wifes iphone shows up by MAC. Any thoughts?
 
Ok so that works well, I have hostname resolution but I have some ordinary DHCP clients that only show up as MAC. For instance, my ipad shows up by its name but my wifes iphone shows up by MAC. Any thoughts?

Did you add dhcp-option=lan,44,x.x.x.x where x.x.x.x is the router's ip and Set as WINS server to Yes?

Listing your dnsmasq.conf here would be helpful.
 
Did you add dhcp-option=lan,44,x.x.x.x where x.x.x.x is the router's ip and Set as WINS server to Yes?

Listing your dnsmasq.conf here would be helpful.

No i've not made any entries in the dhcp config only added the MAC's in reservations through the web front end.

is dnsmasq.conf under /etc? same for dhcp conf?
 
is dnsmasq.conf under /etc? same for dhcp conf?

Yes, as dhcp management is handled by dnsmasq.

If you created dnsmasq.conf.add under /jffs/configs, entries/options in that file would be appended to /etc/dnsmasq.conf so running
Code:
cat /etc/dnsmasq.conf
would list your entire dnsmasq and dhcp configuration for your router.

Did you fill the Default Gateway, DNS Server, WINS Server with the your router's IP and enabled <Force as Master Browser> and <Set As WINS Server> under USB Application / Network Place(Samba) Share / Cloud Disk?
 
Did you add dhcp-option=lan,44,x.x.x.x where x.x.x.x is the router's ip and Set as WINS server to Yes?
Did you fill the Default Gateway, DNS Server, WINS Server with the your router's IP and enabled <Force as Master Browser> and <Set As WINS Server> under USB Application / Network Place(Samba) Share / Cloud Disk?
None of this should be relevant because we're not talking about NETBIOS name resolution on the LAN. The client list is populated from DNS (AFAIK).

Ok so that works well, I have hostname resolution but I have some ordinary DHCP clients that only show up as MAC. For instance, my ipad shows up by its name but my wifes iphone shows up by MAC. Any thoughts?
This should work without any problems (it does for my iphone), so the question is "why is the iphone not registering its hostname in DNS (via DHCP)?"

There could be a number of reasons but its probably because the phone hasn't registered itself with DHCP since you rebooted the router. So I'd start by checking the phones name in iTunes and making sure it doesn't have any non-alphanumeric characters.

Then delete the wifi profile on the phone and recreate it from scratch (using DHCP).

If that fails you could always create an IP reservation for it on the ASUS, then it will definitely have a name.
 
Last edited:
Yes, as dhcp management is handled by dnsmasq.

If you created dnsmasq.conf.add under /jffs/configs, entries/options in that file would be appended to /etc/dnsmasq.conf so running
Code:
cat /etc/dnsmasq.conf
would list your entire dnsmasq and dhcp configuration for your router.

Did you fill the Default Gateway, DNS Server, WINS Server with the your router's IP and enabled <Force as Master Browser> and <Set As WINS Server> under USB Application / Network Place(Samba) Share / Cloud Disk?

Under USB Application - Network Place(Samba) Share / Cloud Disk
Force as Master Browser is YES
Set as WINS server is YES

Under LAN - DHCP Server, DNS and WINS Server Setting
WINS Server: is blank

I'll pull dnsmasq tonight
 
None of this should be relevant because we're not talking about NETBIOS name resolution on the LAN. The client list is populated from DNS (AFAIK).

Just noticed your post (hence the edit) - I beg to differ.. The client list is populated from several lists (DHCP,Custom,2g,5g etc.) and a network map scan function which then takes data gathered from the lists and merges it with the output of the network map scan... specifics in client_function.js

When contemplating solutions, I provide ones that cater to the variety of devices that could possibly be connected to a network. So while the client list/router may populate the hostnames of all connected devices, attempting to ping a client using its hostname from another client ie. windows, NAS etc. may still fail due to a NETBIOS/WINS dependency or incompatibility with dnsmasq due to an incomplete/half baked configuration and/or bugs with the firmware.

WINS Server: is blank

Enter your router's IP in the WINS Server field, apply and reboot. Reconnect all clients and verify. If the issue still persists, rename your wife's iphone to some new name (15 characters or less with no spaces), apply, reconnect wifi and verify.

Apple network enabled products are known to suffer from 'stuck' network profiles, dhcp client id and dns issues on wifi reconnect so recreating the current profile should help too.
 
Last edited by a moderator:
The client list is populated from several lists (DHCP,Custom,2g,5g etc.) and a network map scan function which then takes data gathered from the lists and merges it with the output of the network map scan... specifics in client_function.js
Looking at client_function.js I can see nothing in there that suggests name resolution through WINS (although I may have just missed it) so we'll have to agree to differ on that point. :)
When contemplating solutions, I provide ones that cater to the variety of devices that could possibly be connected to a network...
I would agree with you that in general your suggestions are a good idea. However, in this case it looked like a lot of changes for the OP without actually addressing his problem.

FWIW, before making my first post I had recreated the problem on my network and the solution (for me at least) was to just delete and recreate the profile on the phone and thus force it to reregister with DHCP. YMMV of course. :)
 
Last edited:

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