Net-SNMP

The most of network devices (routers, switches, modems, base stations) support SNMP as management protocol. Using Net-SNMP tools you can manage and test the network devices sending SNMP get, set, walk and other requests from Linux/Windows PC. The graphical MIB browser (tkmib) is also supported.

Here is en example how to create and verify entries in the standard MIB table (v2) using the Net-SNMP tools:


- Create a Maintenance Domain (OID 1.3.111.2.802.1.1.8.1.2) in SNMP IEEE8021-CFM-MIB table using Create&Wait method:


#!/bin/bash

# Define IP address of SNMP agent
agent="192.168.0.124"

clear
echo 'Create MD id=2, MD-name=MD1, level=2'
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.8.2 i 5
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.2.2 i 4
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.3.2 s "MD1"
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.4.2 i 2
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.6.2 i 1
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.8.2 i 1

echo $'\n'
echo 'Check results for MD starting here'
snmpwalk -Os -c public -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2


Here is some explanation of the script:

1. The entry
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.8.2 i 5

sets the dot1agCfmMdRowStatus to value 5 (Create and Wait): create en entry in the table and wait

2. The entries

snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.2.2 i 4   --- sets MD's format
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.3.2 s "MD1"  --- sets MD's name
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.4.2 i 2  --- sets MD's level
snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.6.2 i 1  --- sets CfmIdPermission (sendIdNone(1))


3. The entry

snmpset -c private -v 2c $agent .1.3.111.2.802.1.1.8.1.5.2.1.8.2 i 1

sets the dot1agCfmMdRowStatus to value 1 (Active): activate the created MD in the table

 

No comments:

Post a Comment