配置SNMP,编辑/etc/snmp/snmpd.conf
1.1 首选是定义一个共同体名(community),这里是public,及可以访问这个public的用户名(sec name),这里是notConfigUser。Public相当于用户notConfigUser的密码
1.2 定义一个组名(groupName)这里是notConfigGroup,及组的安全级别,把notConfigUser这个 用户加到这个组中。
1.3 定义一个可操作的范围(view)名, 这里是all,范围是 .1
1.4 定义notConfigUser这个组在all这个view范围内可做的操作,这时定义了notConfigUser组的成员可对.1这个范围做只读操作。
1.5 重启snmpd服务
1.6 列出snmpd开放端口
参考答案:
vi /etc/snmp/snmpd.conf
做如下修改:
# sec.name source community
com2sec notConfigUser default public
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
# name incl/excl subtree mask(optional)
view all included .1
view systemview included .1
或者:
## incl/excl subtree mask
view all included .1
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none
保存退出
service snmpd restart
netstat -anp|grep snmp
直接查看端口
netstat -anp|grep 端口号