Discussion:
[Dnsmasq-discuss] Ping does not work but nslookup works (Use dnsmasq on Mac OS X)
Peng Yu
2013-12-23 15:03:48 UTC
Permalink
Hi,

I followed the instruction at the following address (after section
"Solution: DNSMasq"). My machine is Mac OS X 10.8.5.

http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/

The only difference is that I have the following configuration on my mac machine

/etc$ cat /etc/resolv.dnsmasq.conf
nameserver 192.168.1.25
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc$ sudo networksetup -getdnsservers Wi-Fi
127.0.0.1

192.168.1.25 is another DNS in my home network, which has the
information for oxygen.yulab. But the following commands shows that
ping is not able to find the correct ip. Does anybody know what is
wrong and how to debug such a problem?

Thanks.

~$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: oxygen.yulab
Address: 192.168.1.163

~$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
--
Regards,
Peng
Simon Kelley
2013-12-23 15:14:59 UTC
Permalink
Post by Peng Yu
Hi,
I followed the instruction at the following address (after section
"Solution: DNSMasq"). My machine is Mac OS X 10.8.5.
http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/
The only difference is that I have the following configuration on my mac machine
/etc$ cat /etc/resolv.dnsmasq.conf
nameserver 192.168.1.25
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc$ sudo networksetup -getdnsservers Wi-Fi
127.0.0.1
192.168.1.25 is another DNS in my home network, which has the
information for oxygen.yulab. But the following commands shows that
ping is not able to find the correct ip. Does anybody know what is
wrong and how to debug such a problem?
Thanks.
~$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
~$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
You need to tell dnsmasq that it has to ask only the 192.168.1.25 server
for information about oxygen.yulab.

The way to do this is to remove
nameserver 192.168.1.25 from resolv.dnsmasq.conf and add to the main
dnsmasq configuration file

server=/oxygen.yulab/192.168.1.25

or start dnsmasq with a command line option

dnsmasq --server=/oxygen.yulab/192.168.1.25


Once that's done, queries for *.oxygen.yulab will go to 192.168.1.25 and
everything else will go to Google.

Cheers,

Simon.
Peng Yu
2013-12-23 15:35:23 UTC
Permalink
Post by Peng Yu
Hi,
I followed the instruction at the following address (after section
"Solution: DNSMasq"). My machine is Mac OS X 10.8.5.
http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/
The only difference is that I have the following configuration on my mac machine
/etc$ cat /etc/resolv.dnsmasq.conf
nameserver 192.168.1.25
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc$ sudo networksetup -getdnsservers Wi-Fi
127.0.0.1
192.168.1.25 is another DNS in my home network, which has the
information for oxygen.yulab. But the following commands shows that
ping is not able to find the correct ip. Does anybody know what is
wrong and how to debug such a problem?
Thanks.
~$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
~$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
You need to tell dnsmasq that it has to ask only the 192.168.1.25 server for
information about oxygen.yulab.
The way to do this is to remove
nameserver 192.168.1.25 from resolv.dnsmasq.conf and add to the main dnsmasq
configuration file
server=/oxygen.yulab/192.168.1.25
Here are the current file contents. I have several local servers in
the domain yulab. So I should use "server=/yulab/192.168.1.25"
instead?

/etc$ grep yulab /opt/local/etc/dnsmasq.conf
server=/yulab/192.168.1.25
/etc$ cat /etc/resolv.dnsmasq.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Still, the oxygen server is not available. But others are available.
Do you see how to debug this issue? Thanks.

/etc$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
/etc$ ping boron.yulab
PING boron.yulab (192.168.1.123): 56 data bytes
64 bytes from 192.168.1.123: icmp_seq=0 ttl=64 time=29.629 ms
/etc$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: oxygen.yulab
Address: 192.168.1.163

/etc$ nslookup boron.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: boron.yulab
Address: 192.168.1.123
or start dnsmasq with a command line option
dnsmasq --server=/oxygen.yulab/192.168.1.25
Once that's done, queries for *.oxygen.yulab will go to 192.168.1.25 and
everything else will go to Google.
Cheers,
Simon.
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
--
Regards,
Peng
Peng Yu
2013-12-23 15:52:36 UTC
Permalink
Use --log-queries to see check that the queries for *.oxygen.yulab are going
to the right place. If they are, then check that 192.168.1.25 is givving the
right answer.
I now added "log-queries"

/etc$ grep log-queries /opt/local/etc/dnsmasq.conf
log-queries
/etc$ sudo port unload dnsmasq
/etc$ sudo port load dnsmasq

I don't find where the log is from the manual. Would you please let me
know to check it?
Here is the current output.

/etc$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
/etc$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: oxygen.yulab
Address: 192.168.1.163

/etc$ dig @192.168.1.25 oxygen.yulab

; <<>> DiG 9.8.5-P1 <<>> @192.168.1.25 oxygen.yulab
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43460
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;oxygen.yulab. IN A

;; ANSWER SECTION:
oxygen.yulab. 604800 IN A 192.168.1.163

;; AUTHORITY SECTION:
yulab. 604800 IN NS ns.yulab.

;; ADDITIONAL SECTION:
ns.yulab. 604800 IN A 192.168.1.25

;; Query time: 3 msec
;; SERVER: 192.168.1.25#53(192.168.1.25)
;; WHEN: Mon Dec 23 09:48:53 CST 2013
;; MSG SIZE rcvd: 79
/etc$ dig oxygen.yulab

; <<>> DiG 9.8.5-P1 <<>> oxygen.yulab
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9105
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;oxygen.yulab. IN A

;; ANSWER SECTION:
oxygen.yulab. 604605 IN A 192.168.1.163

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 23 09:52:01 CST 2013
;; MSG SIZE rcvd: 46
--
Regards,
Peng
Simon Kelley
2013-12-23 15:59:48 UTC
Permalink
Post by Peng Yu
Use --log-queries to see check that the queries for *.oxygen.yulab are going
to the right place. If they are, then check that 192.168.1.25 is givving the
right answer.
I now added "log-queries"
/etc$ grep log-queries /opt/local/etc/dnsmasq.conf
log-queries
/etc$ sudo port unload dnsmasq
/etc$ sudo port load dnsmasq
I don't find where the log is from the manual. Would you please let me
know to check it?
It goes to the standard system log. If you can't find that then add
something like

log-facility=/tmp/dnsmasq_log

and it will go to that file.


Simon.
Post by Peng Yu
Here is the current output.
/etc$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
/etc$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
; (1 server found)
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43460
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;oxygen.yulab. IN A
oxygen.yulab. 604800 IN A 192.168.1.163
yulab. 604800 IN NS ns.yulab.
ns.yulab. 604800 IN A 192.168.1.25
;; Query time: 3 msec
;; SERVER: 192.168.1.25#53(192.168.1.25)
;; WHEN: Mon Dec 23 09:48:53 CST 2013
;; MSG SIZE rcvd: 79
/etc$ dig oxygen.yulab
;<<>> DiG 9.8.5-P1<<>> oxygen.yulab
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9105
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;oxygen.yulab. IN A
oxygen.yulab. 604605 IN A 192.168.1.163
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 23 09:52:01 CST 2013
;; MSG SIZE rcvd: 46
Peng Yu
2013-12-23 16:09:27 UTC
Permalink
When I run "dig oxygen.yulab", I see the following log.

Dec 23 10:05:35 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:05:35 dnsmasq[51588]: forwarded oxygen.yulab to 192.168.1.25
Dec 23 10:05:35 dnsmasq[51588]: reply oxygen.yulab is 192.168.1.163

When I run "dig @192.168.1.25 oxygen.yulab", I see the following log.

Dec 23 10:07:24 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:07:24 dnsmasq[51588]: cached oxygen.yulab is 192.168.1.163

So this means dnsmasq is running correctly? Does mac's ping use
something else to resolve ip addresses? Thanks.
Post by Simon Kelley
Post by Peng Yu
Use --log-queries to see check that the queries for *.oxygen.yulab are going
to the right place. If they are, then check that 192.168.1.25 is givving the
right answer.
I now added "log-queries"
/etc$ grep log-queries /opt/local/etc/dnsmasq.conf
log-queries
/etc$ sudo port unload dnsmasq
/etc$ sudo port load dnsmasq
I don't find where the log is from the manual. Would you please let me
know to check it?
It goes to the standard system log. If you can't find that then add
something like
log-facility=/tmp/dnsmasq_log
and it will go to that file.
Simon.
Post by Peng Yu
Here is the current output.
/etc$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
/etc$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
; (1 server found)
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43460
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;oxygen.yulab. IN A
oxygen.yulab. 604800 IN A 192.168.1.163
yulab. 604800 IN NS ns.yulab.
ns.yulab. 604800 IN A 192.168.1.25
;; Query time: 3 msec
;; SERVER: 192.168.1.25#53(192.168.1.25)
;; WHEN: Mon Dec 23 09:48:53 CST 2013
;; MSG SIZE rcvd: 79
/etc$ dig oxygen.yulab
;<<>> DiG 9.8.5-P1<<>> oxygen.yulab
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9105
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;oxygen.yulab. IN A
oxygen.yulab. 604605 IN A 192.168.1.163
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 23 09:52:01 CST 2013
;; MSG SIZE rcvd: 46
--
Regards,
Peng
Simon Kelley
2013-12-23 16:22:48 UTC
Permalink
Post by Peng Yu
When I run "dig oxygen.yulab", I see the following log.
Dec 23 10:05:35 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:05:35 dnsmasq[51588]: forwarded oxygen.yulab to 192.168.1.25
Dec 23 10:05:35 dnsmasq[51588]: reply oxygen.yulab is 192.168.1.163
Dec 23 10:07:24 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:07:24 dnsmasq[51588]: cached oxygen.yulab is 192.168.1.163
So this means dnsmasq is running correctly? Does mac's ping use
something else to resolve ip addresses? Thanks.
No idea. You clearly don't have a DNS problem.

Any MAC experts out there?


Simon.
Post by Peng Yu
Post by Simon Kelley
Post by Peng Yu
Use --log-queries to see check that the queries for *.oxygen.yulab are going
to the right place. If they are, then check that 192.168.1.25 is givving the
right answer.
I now added "log-queries"
/etc$ grep log-queries /opt/local/etc/dnsmasq.conf
log-queries
/etc$ sudo port unload dnsmasq
/etc$ sudo port load dnsmasq
I don't find where the log is from the manual. Would you please let me
know to check it?
It goes to the standard system log. If you can't find that then add
something like
log-facility=/tmp/dnsmasq_log
and it will go to that file.
Simon.
Post by Peng Yu
Here is the current output.
/etc$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
/etc$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
; (1 server found)
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43460
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;oxygen.yulab. IN A
oxygen.yulab. 604800 IN A 192.168.1.163
yulab. 604800 IN NS ns.yulab.
ns.yulab. 604800 IN A 192.168.1.25
;; Query time: 3 msec
;; SERVER: 192.168.1.25#53(192.168.1.25)
;; WHEN: Mon Dec 23 09:48:53 CST 2013
;; MSG SIZE rcvd: 79
/etc$ dig oxygen.yulab
;<<>> DiG 9.8.5-P1<<>> oxygen.yulab
;; global options: +cmd
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9105
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;oxygen.yulab. IN A
oxygen.yulab. 604605 IN A 192.168.1.163
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 23 09:52:01 CST 2013
;; MSG SIZE rcvd: 46
Nikita N.
2013-12-23 18:08:15 UTC
Permalink
.. btw of log facility, if I can give a suggestion.. would be nice to
make it more verbose.. eg. when some behavioral exception is taken, eg.
frame comes and some action should be taken, but it is NOT taken (or
vice) .. a message would be nice, the user will understand whats going
on.. typical my example, if a message would have come to logs, eg.
"timeout upstream server- switching to authoritative mode", that would
have helped :) just an idea btw.. :P
Post by Peng Yu
When I run "dig oxygen.yulab", I see the following log.
Dec 23 10:05:35 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:05:35 dnsmasq[51588]: forwarded oxygen.yulab to 192.168.1.25
Dec 23 10:05:35 dnsmasq[51588]: reply oxygen.yulab is 192.168.1.163
Dec 23 10:07:24 dnsmasq[51588]: query[A] oxygen.yulab from 127.0.0.1
Dec 23 10:07:24 dnsmasq[51588]: cached oxygen.yulab is 192.168.1.163
So this means dnsmasq is running correctly? Does mac's ping use
something else to resolve ip addresses? Thanks.
--
http://www.fastmail.fm - A fast, anti-spam email service.
Koos Pol
2013-12-23 19:00:01 UTC
Permalink
Post by Peng Yu
http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/
(...)
~$ nslookup oxygen.yulab
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oxygen.yulab
Address: 192.168.1.163
~$ ping oxygen.yulab
ping: cannot resolve oxygen.yulab: Unknown host
I'm a far cry from being Mac knowledgeable. But reading the story from the URL
above, combined with your output, I think your Mac uses different name
resolution paths for nslookup and ping. I don't have another explanation for it.

Wat is the contents of /etc/resolv.conf?

Koos

Loading...