1. Install snmp
Server: snmpd
Client: snmp
apt-get install -y snmpd snmp
2. Configure snmp
Locate and open the snmpd configuration file
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
vim /etc/snmp/snmpd.conf
将下面两行注释掉
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
然后在其下面添加
view systemonly included .1
Restart snmp
/etc/init.d/snmp restart
Snmp can get more information after the above changes are complete
3. The local test snmp
snmpwalk -c public -v 2c localhost .1.3.6.1.2.1.1
- -c: word groups
- -v: snmp version
4. Remote access snmp
vim /etc/snmp/snmpd.conf
将下面的行注释掉
agentAddress udp:127.0.0.1:161
并取消下面行的注释
#agentAddress udp:161,udp6:[::1]:161
5. Remote Access test
snmpwalk -c publlic -v 2c snmp服务器ip .1.3.6.1.2.1.1
6. Modify word snmp group
vim /etc/snmp/snmpd.conf
找到并修改下面两行,将public修改为需要的团体字即可
rocommunity public default -V systemonly
rocommunity6 public default -V systemonly