From: Mick <michaelkintzios@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] network discovery tools
Date: Thu, 26 May 2011 20:04:33 +0100 [thread overview]
Message-ID: <201105262004.34740.michaelkintzios@gmail.com> (raw)
In-Reply-To: <4DDE7EA5.7090206@binarywings.net>
[-- Attachment #1: Type: Text/Plain, Size: 4367 bytes --]
On Thursday 26 May 2011 17:24:05 Florian Philipp wrote:
> Am 25.05.2011 21:45, schrieb Harry Putnam:
> > There must be a number of people who post here that have had to do
> > this problem.
> >
> > Discover the addresses of computers on a home network that have
> > connected by way of DHCP. For example: Several wireless connections.
> >
> > I've used static IPS for around 10 yrs, always seemed handier for
> > things like ssh between home lan computers.
> >
> > But recently started using DHCP for wireless connections. It must be
> > such a popular method for some reason.
> >
> > But when you do it that way, and say want to VNC or ssh or the like to
> > something connected by a dhcp serving WAP then how do you find the
> > address?
> >
> > That is, besides something like accessing the WAP and checking the IPs
> > connected to it.
> >
> > Is there some quick and sure way to discover any IPs on the home lan?
> >
> > Some kind of mapper tool?
>
> While I personally prefer a combined DHCP+DNS server like dnsmasq, you
> can also take a look at the whole Zeroconf/MDNS/Avahi/Bonjour stack.
>
> I'm not really sure if you can configure common devices and Linux PCs to
> use the DNS server for internet addresses and MDNS for local ones. In
> theory, it should be possible since you can distinguish them (local
> addresses should not be fully qualified _or_ have the domain .local).
>
> net-misc/mDNSResponder, sys-auth/nss-mdns and net-dns/avahi are probably
> good starting points.
netdiscover seems to do exactly what the OP asked for, although I have used
arping and a couple of scripts I found on the net and modified them.
The first looks like this:
=============================
#!/usr/bin/env bash
quit_on_found=0
packet_count=2
subnet=""
verbose="-q"
usage()
{
cat << EOF
find_ip 1.0 Robin Wood (dninja@gmail.com) (www.digininja.org)
Find used and unused IPs on a network you don't haven an IP address on
usage: $0 options
OPTIONS:
-h Show this message
-c <packet count> The number of ping packets to send, default 2
-s <subnet> First 3 parts of the subnet to test, default
192.168.0
-q Quit when found first free address, default keep
going
-v Verbose
EOF
}
have_arping=`which arping`
if [[ "$have_arping" == "" ]]
then
cat << EOF
usage: $0 options
You must have arping installed and in the current path for this scanner to
work
EOF
exit 1
fi
while getopts ":hvs:qc:" flag
do
case $flag in
h)
usage
exit 1
;;
c)
packet_count=$OPTARG
;;
q)
quit_on_found=1
;;
s)
subnet=$OPTARG
;;
v)
verbose=""
;;
?)
usage
exit 1
;;
esac
done
if [[ "$subnet" == "" ]]
then
cat << EOF
usage: $0 options
You must provide a subnet
EOF
exit 1
fi
if [[ "$verbose" == "" ]]
then
if [[ $quit_on_found == 1 ]]
then
echo "Quiting when found a free address"
fi
echo "Testing subnet $subnet.0/24"
echo "Sending $packet_count packets per IP"
fi
for i in {1..254}
do
IP=$subnet.$i
arping $verbose -c $packet_count $IP
result=$?
if [[ $result == 0 ]]
then
echo "$IP Used"
else
echo "$IP Free"
if [[ $quit_on_found == 1 ]]
then
exit
fi
fi
done
=============================
Google for "find_ip.sh"
The other which I can't find at the moment prints out the MAC address of each
IP address that is in use. Alternatively, run the above script with the -v
option and then scroll back to look at the MAC addresses.
Of course, I was using this before I knew that netdiscover existed - thanks
for sharing!
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2011-05-26 19:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 19:45 [gentoo-user] [OT] network discovery tools Harry Putnam
2011-05-25 19:54 ` Stéphane Guedon
2011-05-25 20:26 ` Vincent-Xavier JUMEL
2011-05-25 19:59 ` [gentoo-user] " Grant Edwards
2011-05-25 20:28 ` Harry Putnam
2011-05-26 18:22 ` Neil Bothwick
2011-05-25 21:55 ` [gentoo-user] " Neil Bothwick
2011-05-26 16:24 ` Florian Philipp
2011-05-26 19:04 ` Mick [this message]
2011-05-28 1:11 ` [gentoo-user] " James
2011-05-29 22:33 ` Harry Putnam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201105262004.34740.michaelkintzios@gmail.com \
--to=michaelkintzios@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox