Or, you can poll a table and get a neater output (use -Cf flag to set delimiter): snmptable -Cf \ -v 2c -c public localhost IF-MIB::ifTable Since that will produce really long, not particularly readable output, especially if there are a lot of interfaces), you can do something like this to get info about a single interface (with index 2 in this example): snmpwalk -v 2c -c public localhost IF-MIB::ifEntry | grep '\.2 ' Or, you can walk the entire sub-tree: snmpwalk -v 2c -c public localhost IF-MIB::ifEntry You can then poll the IF-MIB::ifDescr to see which index corresponds to which interface, for example: IF-MIB::ifDescr.1 = STRING: sit0 X at the end of IF-MIB::ifPhysAddress.1 indicates the object's index in this particular case the index of an interface. They may look something like this: IF-MIB::ifPhysAddress.1 = STRING: 01:23:45:67:89:AA That should return one or a bunch of lines, depending on how many interfaces are present on the box. Specifically, poll IF-MIB::ifPhysAddress OID to get MAC addresses, for example: snmpwalk -v 2c -c public localhost IF-MIB::ifPhysAddress To get interface-related info, you need IF-MIB.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |