Q: How do I set a port's VLAN membership using SNMP?
A:
Using net-snmp, do
c:\net-snmp\usr\bin\snmpset -v 2c -c community switchname 1.3.6.1.4.1.9.9.68.1.2.2.1.2.9 i 86
where 86 is the portname and 9 is the correct SNMP index to the switchport.
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