I have a network problem with my hosts file :-(

Bill McGonigle bill at bfccomputing.com
Mon Dec 13 16:03:01 EST 2004


On Dec 13, 2004, at 10:16, Steven W. Orr wrote:

> dig or nslookup only goes through a dns server. Is there
> such a thing that tells me how the resolver decides which szource it 
> got
> its answer from?

This isn't exactly what you asked for but it may help - it's a script I 
wrote to help me resolve addresses for debugging.  All it does it is 
call the unix system call 'gethostbyname', but that lets you look in 
/etc/hosts, nis, netinfo, etc. whereas dig, nslookup, host are just for 
DNS as you found.  You can spend too much time on a problem only to 
find it's due to an old /etc/hosts entry you didn't notice. DAMHIKT.  
Usage: ./gethostbyname.pl hostname.

-Bill

--- start gethostbyname.pl ---

#!/usr/bin/perl -w
use strict;
use warnings FATAL => 'all';
use Socket;

my $host = shift;
my ($name,$aliases,$addrtype,$length, at addrs) = gethostbyname($host);
print join ( ', ' ,
              map(
                  inet_ntoa($_),
                  @addrs
              )
            ) . "\n";

--- end gethostbyname.pl ---

----
Bill McGonigle, Owner           Work: 603.448.4440
BFC Computing, LLC              Home: 603.448.1668
bill at bfccomputing.com           Cell: 603.252.2606
http://www.bfccomputing.com/    Text: bill+text at bfccomputing.com
AIM: wpmcgonigle                Skype: bill_mcgonigle




More information about the gnhlug-discuss mailing list