What you are trying to do is against the rules. It will not work with any standard implementation!

Read more about DNS

-----
Alain Mouette



A 6 de maio de 2016 01:04:54 Yun Feng Ma <yunfen...@gmail.com> escreveu:

在此输入代码...



在 2016年5月6日星期五 UTC+8上午9:43:50,Ben Noordhuis写道:

On Thu, May 5, 2016 at 9:00 AM, Yun Feng Ma <yunf...@gmail.com
<javascript:>> wrote:
> Hi everyone!
>
> The dns.resolve tries to send request to only the first nameserver in
> /etc/resolv.conf, and if the first nameserver fails to resolve the name,
> dns.resolve just returns and doesn't try to send request to the second
> nameserver.  Is this work-as-design?
>
> Here is an example: the  /etc/resolv.conf is like below in Linux:
> 75.2.4.5
> 75.4.7.6
>
> Run below codes:
> dns.resolve('demo1.sample.com','A',function(err, addresses) {
>         console.log(err);
>         console.log(addresses);
> });
>
> The 'demo1.sample.com' is defined in the second nameserver (75.4.7.6),
so
> the above codes always failed, because the dns.resolve doesn't try to
call
> the second nameserver.
>
> I found nodejs has flag to control this:
>
https://github.com/nodejs/node/blob/master/deps/cares/src/ares_init.c#L255
> seems like the default behaviour is only call the first nameserver, is
there
> any way to make dns.resolve to call all nameservers in /etc/resolv.conf
> until succeed?
>
> Thanks a lot.

The second nameserver is only tried when the first one times out or
returns a malformed reply.  If the first server replies with NXDOMAIN
(domain not found), the second one isn't contacted; that shouldn't be
necessary because DNS is a global registry after all.


Thanks, Ben, for the reply.

In our environment, the first nameserver is our internal DNS server, which
is used to resolve some internal domain names; the second nameserver is the
public nameserver (like google DNS server 8.8.8.8), so this code
 dns.resolve('www.google.com','A',function(err, addresses) { }) will get
failed, because the first nameserver returns NXDOMAIN for "www.google.com".
Do you have any solution for this?

Thanks.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/fc2151fc-c0fe-4126-bdd8-e9bedf3815b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/15485988570.2782.962c06d43ba9274da034cf7d02472879%40bonseletrons.com.br.
For more options, visit https://groups.google.com/d/optout.

Reply via email to