Posted: Wed Jun 28, 2006 15:04 Post subject: Adding to /etc/hosts does not let clients resolve address
Hi,
I'm using the VPN version on 6/15/2006 on a wrt54GS v3. I would think if I added an entry to my /etc/hosts (on the wrt), that my clients would be able to ping by that name. But my WRT does not seem to be performing DNS resolution for my clients.
Joined: 06 Jun 2006 Posts: 731 Location: Erlangen, Germany
Posted: Wed Jun 28, 2006 16:06 Post subject:
When the so-called "resolver" on the client contacts a DNS server to resolve a name
such as "zinc", it does not simply ask for "zinc". Instead, it adds a "." (dot) followed
by a domain name. When the client OS is Un*x, this is the domain name set by the
"search" keyword in the /etc/resolv.conf file. (Don't ask me how it works on Win!)
The bad thing is: When no domain name is specified, the resolver will still add the dot.
You can verify this by trying "ping zinc." or "ping zinc.local" (or whatever domain is
specified on the client.) This should work, because the resolver will not add the domain,
when at least one dot is already present in the name to be resolved..
To fix the problem, identify the domain set on your client machine(s); if it's empty, set
it to "local" or "localnet". On the router, the record for "zinc" should specify the host
name both with and without the domain, e.g.
Joined: 28 Jun 2006 Posts: 6 Location: Douglasville, GA
Posted: Thu Jun 29, 2006 9:33 Post subject: DNS lookups referencing the /etc/hosts file?
i don't recall DNSMasq looking in the /etc/hosts file before querying the DNS for a hostname. i thought only the wrt os would use the /etc/hosts file, and any queryies to it would be passed on to the up-level DNS server, regardless of what entries the /etc/hosts might contain.
maybe something has changed, or i'm completely wrong. i run my own DNS for this reason.
Posted: Wed Nov 22, 2006 23:40 Post subject: dnsmasq using /etc/hosts for static DNS
The problem is that dnsmasq is loading the contents of /etc/hosts or /tmp/hosts (that's where /etc/hosts points to) during booting.
Any changes, applied to the hosts file, after booting, don't take effect for dnsmasq until the next reboot (note: as /etc/hosts is the hosts file for the router itself, the router can ping nodes applied after booting but not the dnsmasq process).
Unfortunately, any changes applied to the /etc/hosts file are lost if the router is shutdown (the /tmp is in RAM) which makes /etc/hosts useless for static DNS.
To solve this issue use the 'addn-hosts' option of dnsmasq to point to a file similar to the /etc/hosts located in /JFFS. Keep in mind that /JFFS needs to be activated (Web-GUI) prior of using!
An other possibility is using the dnsmasq --address= option (even it's original purpose is/was different)
So in the Web-GUI in Additional DNS Options put the following:
Code:
expand-hosts
addn-hosts=/jffs/tmp/hosts
In this case the /jffs/tmp/hosts file could look like:
Code:
192.168.1.30 zinc zink.your-domain
If using the dnsmasq --address= option, the value in Additional DNS Options would be:
Code:
address=/zinc.your-domain/192.168.1.30
It's possible to put several 'address' entries.
For further questions of dnsmasa use dnsmasq --help within at the command prompt.