Thursday, July 07, 2005

Q: How do I display the list of ports and their VLANs using SNMP?

A:
I use the SNMPWALK program, part of the NET-SNMP distribution.
To display list of ports and their VLANs:
snmpwalk -c readcommunity -v 1 switchname .1.3.6.1.4.1.9.9.68.1.2.2.1.2
To display the Cisco port description:
snmpwalk -c readcommunity -v 1 switchname .1.3.6.1.2.1.2.2.1.2
To display the port descriptions you configured:
snmpwalk -c readcommunity -v 1 switchname .1.3.6.1.4.1.9.2.2.1.1.28