On Tuesday, April 30, 2002, at 06:32 , John Edwards wrote:
[..]
> $machine_name = gethostbyaddr(inet_aton($userIP), AF_INET) or die "Can't
> resolve $userIP: $!\n"
>
> It works on the LAN, but not across a router to the remainder of our WAN.
> Any ideas?

My complements to Tim Musson <[EMAIL PROTECTED]> for the
heads up on Net::DNS - but I remain confused by
the core problem...

from the perldoc -f gethostbyaddr

we are back to the case of

        ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr 
ADDR,ADDRTYPE ;

i always feel safer if that is done with

        ($name, @junkIt ) = gethostbyaddr ADDR,ADDRTYPE ;

and then manage the undef, undef case myself... TETO...

and from perldoc socket

     inet_aton HOSTNAME
         Takes a string giving the name of a host, and translates that to 
the
         4-byte string (structure). Takes arguments of both the
         'rtfm.mit.edu' type and '18.181.0.24'. If the host name cannot be
         resolved, returns undef. For multi-homed hosts (hosts with more 
than
         one address), the first address found is returned.

so that should work for both host_names and ip_addr...

{ cool trick.... }

it's the concern of the 'not across a router' - that makes me wonder
if you are running a NetBios problem where you do not have the
tcp services on and doing your DNS on the NT 4.0 box using standard
tcp/ip services....

I use the gethostbyaddr() trick so that I could get either the
local cache from /etc/hosts or make the call out to a DNS resolver.

But if you DNS service is only working 'local' to your 'segment'
could it be that it has no 'external resolver' that can go after
outside IP addresses????

eg: the classic 'firewall' problem. One has an authoritative
DNS server on the 'inside' that can do the resolution for everything
in their domain - and any hand inserted external records - but
does not have access through the firewall to get records from
any of the root servers.

At this point the typical user can telnet/ftp/http only to
the list of allowed sites - since all the rest will fail.

The problem at that point is that one has to do the heavy
lifting of managing all DNS resolution in code.... way too
much work dude....



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to