[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sendmail gethostbyaddr fails



On Sat, Jul 14, 2001 at 03:13:09PM +0200, Carel Fellinger wrote:
> On Sat, Jul 14, 2001 at 02:30:22PM +0200, Joost Kooij wrote:
> ...
> > What does it look like when you "strace host 192.168.1.1"?  It should
> > be showing access to /etc/hosts, if you have "order hosts,bind" in
> > /etc/resolv.conf.
> 
> I think you mean /etc/host.conf?

Oops, yes.

> As I said "host 192.168.1.1" works, and stracing it indeed shows access
> to /etc/resolv.conf, /etc/host.conf and /etc/hosts in that order.
> 
> But "host localhost." goes off to the internet to query my ISP's DNS
> server instead of relying on my /etc/hosts. Stracing it shows access
> to /etc/resolve.conf, but then instead of reading /etc/host.conf and
> /etc/hosts it goes off to "connect" to my ISP's DNS server.

Of course, I should have know this, "host" is expressly a tool to
query name servers.  Look at the package description.  :-)

> This I find strange, it would mean one needs to run a local dns server
> on every privat network for some very basic network functions to work
> properly.

Try this instead:

#!/usr/bin/perl -w
use Socket;
print scalar gethostbyaddr(inet_aton($ARGV[0]), AF_INET) || "(?)", "\n";

Cheers,


Joost



Reply to: