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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值