SNMP设置ubuntu14.04
- 格式:docx
- 大小:12.56 KB
- 文档页数:2
1、
#安装snmp和agent
apt-get install snmp snmpd snmp-mibs-downloader
#安装辅助脚本工具
apt-get install libsnmp-base libsnmp-dev
=========================================
2、启动服务
service snmpd start
=========================================
3、编辑配置文件
vim /etc/snmp/snmpd.conf
修改监听接口,让所有的都可以连接过来
# Listen for connections from the local system only
#agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
加入用户、设置密码
createUser jiankongbao MD5 snmp@jiankongbao
配置用户的权限,是只读、还是只读、可写。。另外设置认证以及加密
无认证无加密是:noAuthNoPriv
有人证无加密是:authNoPriv
有人证有加密是:authPriv
rouser jiankongbao authPriv
=========================================
4、测试
sysLocation
snmpwalk -v 3 -u XXXXXXX -a MD5 -A "XXXXXXX" -l authNoPriv 127.0.0.1 sysLocation snmpwalk -v 3 -l authNoPriv -a MD5 -u 'XXXXXXX' -A 'XXXXXXX' '117.121.26.248' 'sysDescr'
snmpwalk -v 3 -l authNoPriv -a MD5 -u 'XXXXXXX' -A 'XXXXXXX' '117.121.26.248' 'sysDescr' =========================================
5、MIB
安装MIB文件下载器
% apt-get install snmp-mibs-downloader
vim /etc/snmp/snmp.conf
将下面一行注释掉
mibs :
使用ROOT权限去下载更新
% download-mibs
服务器端修改:
vim /etc/default/snmpd
export MIBS=/usr/share/mibs
service snmpd restart
===========================================
6、OK,再一次测试
nmpwalk -v 3 -u XXXXXXX -a MD5 -A "XXXXXXX" -l authNoPriv 127.0.0.1 sysDescr
7、测试端口是否打开
nmap -sU 117.121.26.248
snmpwalk -v 3 -l authNoPriv -a MD5 -u 'XXXXXXX' -A 'XXXXXXX' 'XXXXXXX' 'sysDescr'