« Return to Thread: How do I make Net::DNS::Resolver take /etc/hosts into account?

Re: How do I make Net::DNS::Resolver take /etc/hosts into account?

by Per Jessen :: Rate this Message:

Reply to Author | View in Thread

René Berber wrote:

> On many operating systems (Solaris, Fedora 11, and Gentoo Linux are
> the ones I have) the file /etc/nsswitch.conf controls exactly what you
> are asking, the usual relevant line is:
>
> hosts:       files dns
>
> Which means first look at /etc/hosts, then ask bind (named).
>
> In Fedora 11 the same line is more complex, returning an error before
> using named, but that is not your problem:
>
> hosts:       files mdns4_minimal [NOTFOUND=return] dns

Rene, that's not the issue here at all.

Here it is in a nutshell:

1) a tiny perl test-script using gethostbyname() will look at /etc/hosts
and try to resolve the name from there. Works fine and just as
expected.

2) a call to gethostbyname() from within an SA plugin does NOT look
at /etc/hosts.  

I've tried just instantiating Net::DNS::Resolver in my test-script, but
that changed nothing, which is why I suspect something happens within
SA.


/Per Jessen, Zürich

 « Return to Thread: How do I make Net::DNS::Resolver take /etc/hosts into account?