Monthly Archives: Březen 2012
Cisco SB switche a SNMP
Cisco Small Business switche a ovládání přes SNMP
V poslední době jsem zaslechl mnoho dotazů na infromace k tomu jak ovládat Cisco SB switche pomocí SNMP, tak mě to nedalo a strávil jsem víkend a potřebné informace jsou zde:
Jako první bude potřeba nastavit typ portu na prvku
vlanPortModeState.[PortID] – pro nastavení typu portu
v OID syntaxi pak
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
Za druhé bude potřeba nastavit VLANu na daný port, zde je logika taková, že vytvořím VLANu a přiřadím portům
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
A na konec
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:
- 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