1 安装SNMP
#apt-get snmpd snmp
2 配置SNMP
#vi/etc/snmp/snmpd.conf #agentAddress udp:127.0.0.1:161(注释掉) agentAddressudp:161,udp6:[::1]:161(取消注释) rocommunity qishi default (配置团体名称) #vi /etc/default/snmpd snmpDOPTS=’-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid’改为: snmpDOPTS=’-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.conf’ 重启 snmp 服务: #service snmpd restart
3 添加防火墙策略
#sudo ufw enable #sudo ufw default deny #sudo ufw allow 161/udp