320 | | |
| 320 | = SNMP (8/13) = |
| 321 | Simple Network Management Protocol (SNMP) can be used to get information and configure network devices remotely. The protocol uses management information bases (MIBs), which store information about what can be looked up using SNMP in a tree-like hierarchy (a MIB tree), in order to look up information. Each piece of information has a unique identifier (OID) that denotes which part of the MIB tree they belong in. Information can be pulled up using the OID or their human-readable name (i.e. the administrator-designated status of ports, 1.3.6.1.2.1.2.2.1.7 or ifAdminStatus) |
| 322 | |
| 323 | |
| 324 | == With respect to SB9 == |
| 325 | SB9 is set up to be the manager device for sw-sb09. The switch is configured with an ACL that allows SB9 to access and modify information via SNMP (configuration details [http://www.orbit-lab.org/wiki/Documentation/OpenFlow/CLISetup here]). |
| 326 | |
| 327 | === retrieving information === |
| 328 | syntax : `snmpget|snmpwalk [options] [agent IP/name] [OID]` |
| 329 | |
| 330 | `snmpget` retireves a single piece of information. `snmpwalk` retrieves a whole set of information by calling `getnext` repeatedly. You only need read access to the switch to see the information. |
322 | | |
323 | | |
324 | | |
| 332 | for example, |
| 333 | {{{ |
| 334 | root@sb9:~# snmpwalk -v 2c -c netadmin 172.16.100.10 1.3.6.1.2.1.1 |
| 335 | }}} |
| 336 | |
| 337 | returns |
| 338 | {{{ |
| 339 | SNMPv2-MIB::sysDescr.0 = STRING: ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L] |
| 340 | SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.21839.1.2.11 |
| 341 | DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (26201570) 3 days, 0:46:55.70 |
| 342 | SNMPv2-MIB::sysContact.0 = STRING: |
| 343 | SNMPv2-MIB::sysName.0 = STRING: sw-sb09 |
| 344 | SNMPv2-MIB::sysLocation.0 = STRING: |
| 345 | SNMPv2-MIB::sysServices.0 = INTEGER: 78 |
| 346 | }}} |
| 347 | |
| 348 | `snmpget` follows the identical syntax, but you must specify a single specific parameter, i.e. the status of just one port: |
| 349 | {{{ |
| 350 | snmpget -v 2c -c netadmin 172.16.100.10 1.3.6.1.2.1.2.2.1.7.3 |
| 351 | IF-MIB::ifAdminStatus.3 = INTEGER: up(1) |
| 352 | }}} |
| 353 | |
| 354 | trying to get a block of info like with snmpwalk will just give you errors: |
| 355 | {{{ |
| 356 | snmpget -v 2c -c netadmin 172.16.100.10 1.3.6.1.2.1.2.2.1.7 |
| 357 | IF-MIB::ifAdminStatus = No Such Instance currently exists at this OID |
| 358 | }}} |
| 359 | |
| 360 | === setting information === |
| 361 | `setsnmp [options] [agent IP/name] [OID] [datatype] [data value]` - lets you change the status of a MIB value, given you belong in the access list granted with snmp read/write permissions on the switch. |
| 362 | |
| 363 | the syntax here is not much different here. Here, port 0/1 is manually shut down via snmp: |
| 364 | {{{ |
| 365 | snmpset -v 2c -c netadmin 172.16.100.10 1.3.6.1.2.1.2.2.1.7.10 i 2 |
| 366 | IF-MIB::ifAdminStatus.10 = INTEGER: down(2) |
| 367 | }}} |
| 368 | |
| 369 | for a more detailed look, the tutorial: http://net-snmp.sourceforge.net/wiki/index.php/TUT:snmpset |