Net-SNMP is a free SNMP agent that has excellent support for most UNIX platforms. It comes bundled with most OS platforms and is also available from http://www.net-snmp.org
.
Editing the snmpd.conf file
The only line needed in the net-snmp/share/snmp/snmpd.conf
file (also located in /etc/snmp/
on some vendor systems), is the community string:
## Define a read-only list of SNMP v1/v2 community strings
## Format is rocommunity <community> [hostIP|subnet/bits]
rocommunity public
rocommunity anotherString
After changing these values, you should restart your snmpd.
Configuring SNMP v3 in net-snmp
If you are using the net-snmp software on your server, you can enable SNMP v3 on the snmpd agent using the following steps. Note that there are 2 separate snmpd.conf
files which need to be edited:
snmpd.conf
file (located in /etc/snmp/ or /usr/local/net-snmp/share/snmp/
) and add the following line:rouser myuser priv
This adds SNMP v3 user myuser and specifies that both authentication and encryption of packets is required for this user.
/usr/local/var/snmpd.conf
file (this is a runtime file used by snmpd
has comments in it about not editing manually except to add users).You must stop any running snmpd processes before editing this file:createUser myuser MD5 "myAuthPasswd" DES myEncryptPasswd
This tells the snmpd
process to create a user myuser with the MD5 authentication pass phrase and encryption password as specified.
Then restart snmpd. This line will automatically be replaced by a usmUser entry without the cleartext passwords.
snmpwalk -v 3 -n "" -u myUser -l authPriv -a MD5 -A "myAuthPasswd" -X "myEncryptPasswd" \
192.168.1.100 sysUptime
user : authPassword : encryptPassword