Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9641

Re: how to get a list of all the hosts on the intranet around my workstation?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <t@jollybox.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.080
X-Spam-Evidence '*H*': 0.84; '*S*': 0.00; 'host,': 0.09; 'hosts': 0.09; 'ping': 0.09; 'pythonistas,': 0.09; 'solution,': 0.09; 'wrote:': 0.15; 'dhcp,': 0.16; 'dns.': 0.16; 'host"': 0.16; 'narrow': 0.16; 'received:192.168.1.40': 0.16; 'scientist': 0.16; 'subject: \n ': 0.16; 'pm,': 0.16; 'subject:list': 0.16; 'linux': 0.18; 'header:In-Reply-To:1': 0.22; 'trying': 0.23; '(though': 0.23; 'elegant': 0.23; 'end,': 0.23; 'windows': 0.26; '(and': 0.27; 'host': 0.28; 'network,': 0.28; 'server': 0.29; 'shell': 0.29; 'lot.': 0.30; 'subject:?': 0.31; 'chris': 0.32; 'list': 0.32; 'actually': 0.33; 'to:addr:python-list': 0.34; 'header:User- Agent:1': 0.34; 'there': 0.34; 'however,': 0.34; 'google': 0.34; "can't": 0.34; 'that,': 0.35; 'dns': 0.35; 'uses': 0.35; 'question': 0.35; 'certain': 0.36; 'assuming': 0.37; 'query': 0.37; 'open': 0.37; 'received:192': 0.38; 'user': 0.38; 'subject:: ': 0.38; 'everyone': 0.38; 'something': 0.38; 'case': 0.39; 'received:192.168.1': 0.39; 'should': 0.39; 'to:addr:python.org': 0.39; 'skip:z 10': 0.40; 'address': 0.61; 'miss': 0.64; 'fan': 0.66; 'received:62': 0.67; 'present.': 0.67; 'quality': 0.74; 'hot': 0.82; "(don't": 0.84; '06:31': 0.84; 'amaze': 0.84; 'defense,': 0.84; 'from:addr:t': 0.84; 'machines,': 0.84; 'macs,': 0.84; 'pcs': 0.84; 'here...': 0.91; 'from.': 0.93
Date Sat, 16 Jul 2011 20:15:19 +0200
From Thomas Jollans <t@jollybox.de>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11
MIME-Version 1.0
To python-list@python.org
Subject Re: how to get a list of all the hosts on the intranet around my workstation?
References <a872bea7-3920-44c4-8df2-e75cad47c5f2@p12g2000pre.googlegroups.com>
In-Reply-To <a872bea7-3920-44c4-8df2-e75cad47c5f2@p12g2000pre.googlegroups.com>
X-Enigmail-Version 1.1.2
OpenPGP id=5C8691ED
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1122.1310840120.1164.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310840120 news.xs4all.nl 23877 [2001:888:2000:d::a6]:37084
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9641

Show key headers only | View raw


On 07/16/2011 06:31 PM, Phlip wrote:
> Yes, pythonistas, sometimes I even amaze myself with the quality of
> question that a computer scientist with a 25 year resume can ask
> around here...
> 
> In my defense, a Google search containing "intranet host" will fan out
> all over the place, not narrow on what I actually need.
> 
> The Use Case is a user wants to ping a nearby host, and I provide a
> list of nearby hosts for the user to pick from. Nothing else. Hosts on
> the outernet need not apply.
> 
> pydhcplib? Shell to a DHCP utility? Ping every server in a range
> around my own?

The obvious solution would be a broadcast ping. However, most hosts will
hot respond to a broadcast ping.

If every host in the network uses DHCP (and you are certain that they
all do), you can query the DHCP server — it should have a list of
active/recent hosts.

Chris mentioned DNS — that may be the most elegant solution, assuming
every host has a (registered) name.

If the network is populated only by Windows machines, you can use the
Windows name resolver. If it is populated only by zeroconf-aware
machines (modern Macs, most modern Linux PCs, Windows PCs with Apple
Bonjour installed), then you can use multicast DNS.

In the end, there is only one way to get all active machines: Ping
everyone on the subnet. You can get the local IP address and netmask
(don't ask me how), and ping every host on the subnet one-by-one. There
are tools that do this (though I can't name one off the top of my head).
This will only miss those hosts that don't respond to pings. (and even
they may be detected by trying to open other ports)

On a homogeneous network, query the infrastructure that is present. If
the network may contain "odd" machines that don't use DHCP, or something
like that, you'll have to ping the lot.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to get a list of all the hosts on the intranet around my workstation? Phlip <phlip2005@gmail.com> - 2011-07-16 09:31 -0700
  Re: how to get a list of all the hosts on the intranet around my workstation? Chris Angelico <rosuav@gmail.com> - 2011-07-17 02:52 +1000
  Re: how to get a list of all the hosts on the intranet around my workstation? Emile van Sebille <emile@fenx.com> - 2011-07-16 11:04 -0700
  Re: how to get a list of all the hosts on the intranet around my workstation? Thomas Jollans <t@jollybox.de> - 2011-07-16 20:15 +0200
  Re: how to get a list of all the hosts on the intranet around my workstation? Chris Angelico <rosuav@gmail.com> - 2011-07-17 04:19 +1000
  Re: how to get a list of all the hosts on the intranet around my workstation? Chris Angelico <rosuav@gmail.com> - 2011-07-17 04:27 +1000
  Re: how to get a list of all the hosts on the intranet around my workstation? Christian Heimes <lists@cheimes.de> - 2011-07-16 21:59 +0200
  Re: how to get a list of all the hosts on the intranet around my workstation? Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-07-16 16:01 -0400

csiph-web