cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11017
Views
10
Helpful
8
Replies

VLAN Management via SNMP on SG300-10 Switches

jan.zacharias
Level 1
Level 1

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

8 Replies 8

jan.zacharias
Level 1
Level 1

ping

Ivor Diedricks
Cisco Employee
Cisco Employee

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)

perfect - works great!

~# snmpset -v 2c -c public 1.3.6.1.2.1.17.7.1.4.3.1.5.77 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.77 s vlan77 1.3.6.1.2.1.17.7.1.4.3.1.2.77 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.3.77 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.77 x 0x00

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 1.3.6.1.2.1.17.7.1.4.3.1.5.78 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.78 s vlan78 1.3.6.1.2.1.17.7.1.4.3.1.2.78 x 0x0A 1.3.6.1.2.1.17.7.1.4.3.1.3.78 x 0x0A 1.3.6.1.2.1.17.7.1.4.3.1.4.78 x 0x0A

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.

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 1.3.6.1.2.1.17.7.1.4.3.1.5.78 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.78 s vlan78 1.3.6.1.2.1.17.7.1.4.3.1.2.78 x 0x0A 1.3.6.1.2.1.17.7.1.4.3.1.3.78 x 0x0A 1.3.6.1.2.1.17.7.1.4.3.1.4.78 x 0x0A

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 1.3.6.1.2.1.17.7.1.4.3.1.5.78 i 4 1.3.6.1.2.1.17.7.1.4.3.1.1.78 s vlan78 1.3.6.1.2.1.17.7.1.4.3.1.2.78 x 0x0000000000000a 1.3.6.1.2.1.17.7.1.4.3.1.3.78 x 0x00 1.3.6.1.2.1.17.7.1.4.3.1.4.78 x 0x0000000000000a


Thanks,

Ivor

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

Hello Ivor,

i have success find how i can change Tagged, Untagged and Forbidden, now i looking only for setup Type of port

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:

  1. Set Access mode for port e1 (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.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

      Nice summary, Tomas.

      Add two clarifications here.

      1. The VID for vlanPortModeTable illustrates the index of interface (ifIndex). The VID for dot1qVlanStaticTable represents the vlan id, that you like to create.
      2. The previous example is applied to SF300, not SG300. The interface index (ifIndex) for SG300 starts from 49, instead of 1. As this particular customer purchased SG300-10, below is the example that works for SG300.


        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

      Getting Started

      Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

      Switch products supported in this community
      Cisco Business Product Family
      • CBS110
      • CBS220
      • CBS250
      • CBS350
      Cisco Switching Product Family
      • 110
      • 200
      • 220
      • 250
      • 300
      • 350
      • 350X
      • 550X