SNMPv3 操作手册

 

使用net-snmp

协议SNMPv3

1,创建一个用户(create a new snmpv3 user and give them rights to do things):

net-snmp-config --create-snmpv3-user -a "my_password" myuser

WARNING: SNMPv3 pass phrases must be at least 8 characters long!

my_password 使用(MD5和DES算法加密保护),Note that encryption support isn't enabled in the binary releases downloadable from the net-snmp web site.

测试:

Start the agent and test your setup:
    /usr/local/sbin/snmpd
[...wait a few seconds... It will run in the background and return you to your shell immediately.]

    snmpget -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0
[ this should return information about how long your agent has been up]

    snmpget -v 3 -u myuser -l authPriv -a MD5 -A my_password -x DES -X my_password localhost sysUpTime.0
[ this should return similar information, but encrypts the transmission ]

使用snmptrapd程序:

1)and the securityName and engineID must exist as a pair in the remote user table.

Stop any currently running snmptrapd
edit /var/net-snmp/snmptrapd.conf to insert the following line:
  createUser myuser MD5 mypassword DES myotherpassword
Where myuser is the security name you want to use, and mypassword is your authentication password and myotherpassword is your encryption password (or leave it blank if you want it to be the same or don't want to use encryption).
(re)start the snmptrapd program.

测试:

snmpinform -v 3 -u myuser -a MD5 -A mypassword -l authNoPriv localhost 42 coldStart.0

其中myuser必须是在localhost上的用户。

如何自定义trap类型?

主机A上安装有设备,由snmp管理;主机B上负责接受主机A上传递过来的trap(在后台运行snmptrapd程序)

目的:自定义trap类型

1)在主机A上做mib库的扩展,添加自定义的trap类型,然后编译进snmpd。

那么,是否需要在主机B上做类似的扩展?如果不需要,那么主机B上如何识别主机A上自定义的trap类型。

Writing a net-snmp MIB Module

一, Compiling in your new MIB module

1, Compile it into the master agent.

% ./configure --with-mib-modules="nstAgentModuleObject"

    To do this, you would put the nstAgentModuleObject.h and nstAgentModuleObject.c files into the net-snmp source code directory. You do this by copying them into a agent/mibgroup/nstAgentModuleObject.h and agent/mibgroup/nstAgentModuleObject.c file.

2, % make

3, % make install

4, % /usr/local/sbin/snmpd

5,测试

snmpget -u louis -a MD5 -A wohaolouis -l authNoPriv localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0

你可能感兴趣的:(网络知识)