For When You Can't Have The Real Thing
[ start | index | login ]
start > perl > convert Hex MAC to decimal OID

convert Hex MAC to decimal OID

Created by dave. Last edited by dave, 15 years and 40 days ago. Viewed 12,679 times. #3
[diff] [history] [edit] [rdf]


When you are dealing with MAC addresses, systems like to print them out as hexadecimal numbers:

# arp -an
? ( at 00:80:F0:56:46:30 [ether] on eth0

...but OID values in SNMP are decimal.


I call this script hexmac2decoid


$in=shift @ARGV; @elements=split(/:/,$in); for $element (@elements) { print ".".hex($element); }


# snmpwalk -v 1 -c public procurve1 . | grep `hexmac2decoid 00:10:DB:35:41:55`
SNMPv2-SMI::mib- = INTEGER: 1

This tells us that MAC address 00:10:DB:35:41:55 is reachable through port 1 on procurve1 (ref: Switching Tables).

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt