By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,923 Members | 1,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,923 IT Pros & Developers. It's quick & easy.

unknown host

P: n/a
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?

Jun 1 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a

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

Jun 1 '07 #2

P: n/a
abcd <co*******@gmail.comwrote:
>I have a linux machine (ip = 10.10.10.8), which can ping other
machines on the same subnet...such as
[ ... ]
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?
Almost certainly it's a name resolution configuration problem --
check that on the Linux machine 'host 10.10.10.x' gives the same
results as Python, then go and look at what you've got in
/etc/hosts and /etc/resolv.conf .

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jun 1 '07 #3

P: n/a
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?
Probably the Windows hosts are resolving the addresses to names using
WINS, a NetBIOS-over-TCP compatible naming service, while the Unix hosts
are trying to use the DNS.

If you could arrange for your hosts to register on the DNS automatically
that might solve the problem.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------

Jun 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.