Hostname resolution /etc/hosts?

Hi there

Just upgraded to 3.8.1 but hostname resolution is still an issue.

In luci, there’s a in the dns tab a checkbox to ignore /etc/hosts file. By default, it’s deactivated. So am I right to assume that it is being read?

Well, if so, it doesn’t work.

I did add a new entry to the /etc/hosts file, reboot router. When I tried to ping that added hostname, I just get an error. host not found.

so, how comes that the /etc/hosts is supposed to be read by the system yet it doesn’t do anything?

You can add the entries to the Static Hosts menu in luci, and they will work (might require a reload of the resolver).

still doesn’t answer the question:

If luci uses the /etc/hosts file and if I add local ips and stuff for resolution. Why doesn’t it work?

I wonder if you need to set option static_domains '1' in /etc/config/resolver, under kresd. I have it set.

IIRC that one is 1 by default.

In any case, I confirm /etc/hosts is not used. Static host definitions are taken from /etc/config/dhcp.

This is a recently tested solution: How to access lan ressources from guest network

So, I set an entry in Luci’s Network -> Hostnames configuration, however that is not pingable from the TO itself.

I can ping that hostname from the machine itself… I can’t test it from other machines as I can’t connect to wifi

@hyper_ch:

  1. make sure you have enabled the feature “Enable DHCP clients in DNS” in Foris web UI (not in LuCi)
  2. fiddling with DNS-related settings of dnsmasq in LuCi has no effect, it is a trap => 3.8.1 in RC: better DNS work and new Nextcloud
  3. if you want to go with “Static Hosts” route please read about my working solution here: DNS: which resolver to use?

I still don’t manage…

I assume with admin/network/hosts you actually meant admin/network/hostnames

Anway, I just can’t configure that it should just use “xxx” has hostname… it always wants that annoying “lan”…

If I do set set the local domain to “lan” and then add a dhcp-static lease for “xxx” then I can ping “xxx.lan”. If I remove the lan from the local domain and leave it empty - it doesn’t work.