[Dnsmasq-discuss] form of lines in host file

Simon Kelley simon at thekelleys.org.uk
Sun Oct 8 09:48:40 BST 2006


Richard Crane wrote:
> I have added lines of the form
> 
> 24.3.20.172.in-arpa.addr alvin
> 
> to the hosts file, and the line
> 
> local=/0.0.20.172.in-arpa.addr/
> 
> to implement rDNS lookups, but I get entries of the form  "dnsmasq: bad
> address at /etc/dnsmasq_hosts line 19"  in the log file on startup.
> 
> But: the reverse lookup works --
> 
> $ dig -x 172.20.3.24
> 
> ; <<>> DiG 9.2.2 <<>> -x 172.20.3.24
> ;; global options:  printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34076
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;24.3.20.172.in-addr.arpa.      IN      PTR
> 
> ;; ANSWER SECTION:
> 24.3.20.172.in-addr.arpa. 0     IN      PTR     alvin.haskins.yale.edu.
> 
> ;; Query time: 8 msec
> ;; SERVER: 172.20.3.28#53(172.20.3.28)
> ;; WHEN: Fri Oct  6 10:02:51 2006
> ;; MSG SIZE  rcvd: 78
> 
> 
> Why the log entry?
> 

You don't need the lines in /etc/hosts, dnsmasq always creates a reverse
entry from the first name in each /etc/hosts line.

so 1.2.3.4 somename somealias

will return 1.2.3.4 for forward queries on somename and somealias

a reverse query on 1.2.3.4 will be turned into a PTR query for
4.3.2.1.in-addr.arpa (because that's how they work) and that will get a
reply of "somename"

If a reverse query doesn't hit something in /etc/hosts, then it will be
forwarded upstream, unless that's stopped by a local= line.

So your

local=/0.0.20.172.in-arpa.addr/

is not quite right. Assuming you don't want useless reverse queries for
any address in 172.20.*.* then it should be

local=/20.172.in-arpa.addr/

That will match any reverse queries in that range.

HTH

Simon.




More information about the Dnsmasq-discuss mailing list