unknown host

Michael Bentley michael at jedimindworks.com
Fri Jun 1 09:35:37 EDT 2007


On Jun 1, 2007, at 8:09 AM, abcd wrote:

> I have a linux machine (ip = 10.10.10.8), which can ping other
> machines on the same subnet...such as
>
> 10.10.10.1
> 10.10.10.2
> 10.10.10.5
> 10.10.10.6
> 10.10.10.254
>
> If I use socket.gethostbyaddr(<ip>) I get back results when ip is
> 10.10.10.1 and 10.10.10.254 but for the other IP addresses
> (10.10.10.5, .6, etc) I get back "unknown host".  In fact I get
> "unknown host" for the linux machine that I run the gethostbyaddr
> from.
>
> If perform the same operation from a windows machine (ip = 10.10.10.5)
> it returns data for the other IP addresses as expected.
>
> any ideas?

socket.gethostbyaddr() is trying to use a name server to look up the  
address.  It may be that you haven't specified a valid name server  
in /etc/resolv.conf, or maybe /etc/nsswitch.conf is misconfigured, or  
maybe your name server doesn't want to play.

The fact that you were able to ping addresses have nothing to do with  
resolving their hostnames.

hope this helps,
Michael
---
A clever person solves a problem. A wise person avoids it. --Albert  
Einstein






More information about the Python-list mailing list