- 作者:zhaozj
- 发表时间:2020-12-23 11:03
- 来源:未知
使用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程序)