[juneau-lug] Identify mac addresses
- From: "James Zuelow" <James_Zuelow@xxxxxxxxxxxxxxx>
- To: <juneau-lug@xxxxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 09:10:43 -0800
We had a requirement to identify a piece of equipment by MAC address,
and I thought I might need to do it again one day. =20
CAUTION. Last time I tried to send a script through Outlook, it really
mangled the newlines. If it doesn't work, look for strange lines!
--------------------8<--------------------------
#!/bin/bash
########################################################################
#################
# id-mac.sh
# identifies the equipment manufacturer based on mac address.
# Depends on a current copy of oui.txt from
http://standards.ieee.org/regauth/oui/oui.txt
# Depends on the arping utility (unfortunately run as root -- use sudo)
# James Zuelow // Juneau Linux Users Group
# 28 April 2006
########################################################################
#################
if [[ -z $1 ]]
then
echo "Useage: id-mac.sh (IP ADDRESS)"
exit 1
else
OUI=3D/root/data/oui.txt
MACID=3D`arping -c 1 $1 | awk '/bytes from/ { print $4 }' | cut -c
-8 | sed s/:/-/g`
echo "Manufacturer of device at $1 is:"
grep $MACID $OUI
exit 0
fi
--------------------8<--------------------------
James Zuelow....................CBJ MIS (907)586-0236
Network Specialist...Registered Linux User No. 186591
------------------------------------
The Juneau Linux Users Group -- http://www.juneau-lug.org
This is the Juneau-LUG mailing list.
To unsubscribe, send an e-mail to juneau-lug-request@xxxxxxxxxxxxx with the
word unsubscribe in the subject header.
Other related posts: