08-08-2011 09:13 AM
Dear Cisco,
could you please provide some snmpset commands to add, modify and delete vlan table entries on SG300-10 switches?
I checked http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a00801c6035.shtml however this
information is apparently only valid for catalysts.
The latest firmware is installed and the provided MIB files are used.
Thank You & Best Regards,
Jan
08-24-2011 08:34 AM
ping
08-24-2011 06:09 PM
Jan,
Please make sure this particular community has write access to this dot1dBridge.qBridgeMIB (1.3.6.1.2.1.17), before any snmpset operations.
-- Create a VLAN to Sx300 switch
For instance, create VLAN 3
Add a new entry on do1qVlanStaticTable(1.3.6.1.2.1.17.7.1.4.3) and with instance 3
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.3 = INTEGER: 4 (create and go)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.1.3 = STRING: "vlan3" (vlan name)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.3 = Hex-STRING: “0x00” (This is bit map representation of ports on device in HEX format, and have to fill something even for 0)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.3.3 = Hex-STRING: “0x00” (This field has the same definition as static field)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.4.3 = Hex-STRING: “0x00” (This field has the same definition as static field)
Below is the example how to represent port in big map Hex format.
Port you like to add binary number representation hex number in SNMP should be
e1 1000 0000 0000 0000 0x80
e5 and e7 0000 1010 0000 0000 0x0A
-- Edit a VLAN on Sx300 switch
For instance, change the name of VLAN 3 on previous example
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 1 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3edit 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
Set do1qVlanStaticRowStatus field on instance 3 as active(1) and modify dot1qVlanStaticName field to new string.
-- Delete a VLAN from Sx300 switch
For instance, delete VLAN 3
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 6 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3edit 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
Set do1qVlanStaticRowStatus field on instance 3 as destroy(6) Please make sure this particular community has write access to this dot1dBridge.qBridgeMIB (1.3.6.1.2.1.17), before any snmpset operations.
-- Create a VLAN to Sx300 switch
For instance, create VLAN 3
Add a new entry on do1qVlanStaticTable(1.3.6.1.2.1.17.7.1.4.3) and with instance 3
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.3 = INTEGER: 4 (create and go)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.1.3 = STRING: "vlan3" (vlan name)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.3 = Hex-STRING: “0x00” (This is bit map representation of ports on device in HEX format, and have to fill something even for 0)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.3.3 = Hex-STRING: “0x00” (This field has the same definition as static field)
SNMPv2-SMI::mib-2.17.7.1.4.3.1.4.3 = Hex-STRING: “0x00” (This field has the same definition as static field)
Below is the example how to represent port in big map Hex format.
Port you like to add binary number representation hex number in SNMP should be
e1 1000 0000 0000 0000 0x80
e5 and e7 0000 1010 0000 0000 0x0A
-- Edit a VLAN on Sx300 switch
For instance, change the name of VLAN 3 on previous example
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 1 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3edit 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
Set do1qVlanStaticRowStatus field on instance 3 as active(1) and modify dot1qVlanStaticName field to new string.
-- Delete a VLAN from Sx300 switch
For instance, delete VLAN 3
> snmpset -v 2c -c private 10.5.233.98 1.3.6.1.2
.1.17.7.1.4.3.1.5.3 i 6 1.3.6.1.2.1.17.7.1.4.3.1.1.3 s vlan3edit 1.3.6.1.2.1.17.7.1.
4.3.1.2.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.3 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.
3 x 0x00
Set do1qVlanStaticRowStatus field on instance 3 as destroy(6)
11-08-2011 05:22 AM
perfect - works great!
~# snmpset -v 2c -c public
SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.77 = INTEGER: 4
SNMPv2-SMI::mib-2.17.7.1.4.3.1.1.77 = STRING: "vlan77"
SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.77 = Hex-STRING: 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.3.77 = Hex-STRING: 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.4.77 = Hex-STRING: 00
There is only one thing I didn't get working. If I try to specify the ports via snmp I get an error:
~# snmpset -v 2c -c public
Error in packet.
Reason: wrongLength (The set value has an illegal length from what the agent expects)
Failed object: SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.78
What worng with this - Please help.
11-09-2011 11:19 AM
Hendrik.
There are two areas that data which needs to be modified:
1) The value for “1.3.6.1.2.1.17.7.1.4.3.1.3.78” should set as 0x00, as you like to add port 5 and 7 into VLAN 78.
snmpset -v 2c -c public
2) The ifindex on our GE device is starting from 49. You can check ifXTable for details. Since that, the corresponding ifIndex for Port 5 is 53, and Port 7 is 55. Therefore, the corresponding bit map for Port 5 is 00 00 00 00 00 00 08, and bit map for Port 7 is 00 00 00 00 00 00 02. The correct hex for Port 5 and 7 would be 00 00 00 00 00 00 0a. Try the following command, it should work.
snmpset -v 2c -c public
Thanks,
Ivor
03-16-2012 11:43 AM
Hello Ivor,
thank you for good guide, i looking for SNMP management of type port, i means how i can setup, ACCESS, GENERAL, TRUNK
and from your guide, how i can setup Tagged and Untaged or Forbidden?
Regards,
Tomas
03-16-2012 01:03 PM
Hello Ivor,
i have success find how i can change Tagged, Untagged and Forbidden, now i looking only for setup Type of port
03-18-2012 05:52 PM
Hello everybody !
After working sunday i have finaly result for everyone :-)
At first i need setup type of port, by default all port in Sx300 switches have Trunk mode,
vlanPortModeState.[VID] - to set mode of switch port
in OID example
1.3.6.1.4.1.9.6.1.101.48.22.1.1.[VID]
set INTEGER
1 - General
2 - Access
3 - Trunk
7 - Customer QinQ
Second i set VLAN to specific port
dot1qVLANStaticTable- to create the VLAN and add the required ports to it:
dot1qVLANStaticTable.1.1.[VID] - name of vlan
dot1qVLANStaticTable.1.2.[VID] - port member of the VLAN. This is shown as a bitmap of the ports (remember this has to be a bitmap values - according to the ports you want to configure. for port 9 the value is 0x00 0x80 or binary: 0000000010000000
dot1qVLANStaticTable.1.3.[VID] - forbidden egress ports - usually set to 0x00
dot1qVLANStaticTable.1.4.[VID] - untagged ports - value in hex numbers, depending if the added port is tagged or untagged (if not updated VLAN membership will be tagged)
dot1qVLANStaticTable.1.5.[VID] - row status - createandgo (4) - for new VLAN or active (1) for an existing VLAN and delete (6) for delete VLAN from database.
in OID example
1.3.6.1.2.1.17.7.1.4.3.1.5.[VID] i 4 - INTEGER (create and go)
1.3.6.1.2.1.17.7.1.4.3.1.1.[VID] s vlanID - STRING (VLAN name)
1.3.6.1.2.1.17.7.1.4.3.1.2.[VID] x 0x00 - Hex-STRING (Bitmap)
1.3.6.1.2.1.17.7.1.4.3.1.3.[VID] x 0x00 - Hex-STRING
1.3.6.1.2.1.17.7.1.4.3.1.4.[VID] x 0x00 - Hex-STRING
at the end :-)
Binary map represent port in BIN mode like this:
Port you like to add binary number representation hex number in SNMP should be
e1 1000 0000 0000 0000 0000 0000 0x8000
e5 and e7 0000 1010 0000 0000 0000 0000 0x0A00
where every position represented port in switch, for calculate binary/hex format you can use this link
http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html
Finaly example for SNMP in linux:
snmpset -v 2c -c string 10.58.253.251 .1.3.6.1.4.1.9.6.1.101.48.22.1.1.1 i 2
RESULT:SNMPv2-SMI::enterprises.9.6.1.101.48.22.1.1.1 = INTEGER: 2
2. Set VLAN 555 with name vlan555 to Access port as Untaged and Primary like PVID
snmpset -v 2c -c string 10.58.253.251 1.3.6.1.2.1.17.7.1.4.3.1.5.555 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.555 s vlan555 1.3.6.1.2.1.17.7.1.4.3.1.2.555 x 0x8000 1.3.6.1.2.1.17.7.1.4.3.1.3.555 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.555 x 0x8000
RESULT: SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.555 = INTEGER: 4
SNMPv2-SMI::mib-2.17.7.1.4.3.1.1.555 = STRING: "vlan555"
SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.555 = Hex-STRING: 80 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.3.555 = Hex-STRING: 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.4.555 = Hex-STRING: 80 00
Heureka :-) Cisco SB switch can be configured by SNMP
Tomas
03-19-2012 10:15 PM
Nice summary, Tomas.
Add two clarifications here.
1.) Set Access mode for port GE1 (port ID 1)
snmpset -v 2c -c string 10.58.253.251 .1.3.6.1.4.1.9.6.1.101.48.22.1.1.49 i 2
RESULT:SNMPv2-SMI::enterprises.9.6.1.101.48.22.1.1.49 = INTEGER: 2
2.) Set VLAN 555 with name vlan555 to Access port as Untaged and Primary like PVID. Add port 1 (GE1) to this specific VLAN 555.
snmpset -v 2c -c string 10.58.253.251 1.3.6.1.2.1.17.7.1.4.3.1.5.555 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.555 s vlan555 1.3.6.1.2.1.17.7.1.4.3.1.2.555 x 0x0000000000008000 1.3.6.1.2.1.17.7.1.4.3.1.3.555 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.555 x 0x0000000000008000
RESULT: SNMPv2-SMI::mib-2.17.7.1.4.3.1.5.555 = INTEGER: 4
SNMPv2-SMI::mib-2.17.7.1.4.3.1.1.555 = STRING: "vlan555"
SNMPv2-SMI::mib-2.17.7.1.4.3.1.2.555 = Hex-STRING: 00 00 00 00 00 00 80 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.3.555 = Hex-STRING: 00
SNMPv2-SMI::mib-2.17.7.1.4.3.1.4.555 = Hex-STRING: 00 00 00 00 00 00 80 00
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide