Tech Support > Operating Systems > Linux / Variants > Grabbing MAC addresses
Grabbing MAC addresses
Posted by ElectroQte on January 22nd, 2004


I need to enter in 60 MAC addys of linux comps which are being imaged
with system imager. I want to grab the MACs of all 60 instead of
having to plug a monitor to each one and write it down. Anyone know as
easier way?

Posted by Uli Wachowitz on January 22nd, 2004


phil@electrophoria.com (ElectroQte) wrote:

Are they on your local lan? Can you ping them? If so, do it and read your
arp-cache after that.

'man arp'



Posted by Jim Richardson on January 22nd, 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22 Jan 2004 13:06:39 -0800,
ElectroQte <phil@electrophoria.com> wrote:

If they are all on the same segment, then there are several methods. I'd
look at tcpdump or ethereal, also karpski will monitor the interface,
and save all addresses to a file when you quit. This file will include
the MAC addressess, it's an easy matter to extract them from the std
karpski file with the following.

cat logfile |tr -s \' \ |cut -d\ -f1-3|sort|uniq


Which should produce something like...


00:04:5A7:8F:59 192.168.1.1
00:04:5A7:8F:59 204.122.16.13
00:04:5A7:8F:59 204.127.198.4
....

Note, this will be a list of unique pairs of MAC and IP addressess,
not all the IP addresses will be on your net segment, some, will be
outside the gateway. But all the MAC addressess will be on the local
segment. (modulo MAC switches.)

a partial with perl, would be,

perl -wlna -e 'print $F[0],"\t",$F[1];' logfilename

But I am a newbie to perl, so there's probably a better way to do the
above. Scratch that, I *know* there's a better way to do it in perl than
that, even partially...




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAEEs3d90bcYOAWPYRAtWmAKCfsnu+4YdMiQPbSOKtCo lVBfu29gCgqL+U
hc8zPjAgMas41wRwJa1SQHE=
=tRUU
-----END PGP SIGNATURE-----

--
Jim Richardson http://www.eskimo.com/~warlock
"Hello, and thank you for calling MicroSoft technical support. May I
ask what version of Code Red your server is running?"

Posted by H Brett Bolen on January 23rd, 2004



http://ish.cx/~jason/arpscan/

There is also one with tath doesn't require libdnet.

I think it was version 0.5.



Jim Richardson wrote:

Posted by H Brett Bolen on January 23rd, 2004


found ver 0.5.

http://wizard.ae.krakow.pl/~jb/arpscan/

b


Similar Posts