搜档网
当前位置:搜档网 › CentOS SNMP V3配置

CentOS SNMP V3配置

CentOS SNMP V3配置
CentOS SNMP V3配置

CentOS SNMP V3 1.系统配置:
2.安装 Net-SNMP
CentOS 及其它 RedHat 系列产品提供了 net-snmp 的二进制包。我们可以直接从源里安装。
shell>yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp-libs php-snmpdmidecodelm_sensorsperl-Net-SNMP net-snmp-perl
shell>yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC
shell> yum install net-snmp net-snmp-devel net-snmp-utils

安装成功后查看 snmpd 版本
说明 net-snmp-devel 是为了使用 net-snmp-config, net-snmp-utils 是为了使用 snmpwalk。 :
3.关闭 V1、V2C 协议(可选)
4.配置 Net-SNMP
注意:运行之前请先停用 net-snmp 服务。
shell> service snmpd stop
CentOS 下的 net-snmp 无法在 selinux 环境下正常使用 v3。如果您想使用 snmp v3,请先禁用 selinux。
shell> net-snmp-config -Asxis@https://www.sodocs.net/doc/7818623842.html, -a MD5 sxismd5
--create-snmpv3-user
-ro
shell>net-snmp-config --create-snmpv3-user -Asxis@https://www.sodocs.net/doc/7818623842.html, -aSHAsxissha
-ro

以上命令,创建 2 个 snmpv3 用户,只读,使用 MD5/SHA,用户名为 sxismd5/sxissha,密码为 sxis@https://www.sodocs.net/doc/7818623842.html,。
5.运行 Net-SNMP
运行 Net-SNMP 服务的方法比较简单。
shell> service snmpd start
您可能需要把它加入开机自动运行服务列表。
shell>chkconfigsnmpd on
6.检测 Net-SNMP
我们可以使用 snmpwalk 来检测 snmp 服务是否正常开启。
shell>snmpwalk -v 3 -u sxismd5 -a MD5 -A "sxis@https://www.sodocs.net/doc/7818623842.html," -l authNoPriv 127.0.0.1 sysDescr
shell>snmpwalk -v 3 -u sxissha -aSHA -A "sxis@https://www.sodocs.net/doc/7818623842.html," -l authNoPriv 127.0.0.1 sysDescr

shell>snmpwalk -v 3 -u sxissha -lauthNoPriv 127.0.0.1 if
-aSHA
-A
"sxis@https://www.sodocs.net/doc/7818623842.html,"

相关主题