All the following commands should work on Ubuntu, or just about any other Debian based Linux distro. If you have a firewall on the server, you’ll need to allow UDP on port 161.
Install snmp, snmpd, and libsnmp.
sudo apt-get -y install snmp snmpd libsnmp-dev
Stop the snmpd service so we can add a user
sudo service snmpd stop
Add SNMP v3 user
- Change AuthPassword to your Authentication password
- Change CryptoPassword to your Crypto Password
- Change privUser to your private users username
sudo net-snmp-config --create-snmpv3-user -ro -A AuthPassword -X CryptoPassword -a MD5 -x AES privUser
Change System Location, System Contact, and allow SNMP on all interfaces
Open up the SNMP config file usually in /etc/snmp/snmpd.conf
Search for “sysLocation” and change to whatever your system location is.
Search for “sysContact” and change it. It should be right underneath sysLocation.
Now allow SNMP on all interfaces. Find the following line and comment it out.
Add a # to the beginning.
Now find this line (should be a couple lines down from the line you just commented out)
and uncomment it
That will enable it so you can read the SNMP info using the servers IP address, as opposed to being limited to localhost.
Start the SNMP service and Test
Start the SNMP service
service snmpd start
snmpwalk -v3 -a MD5 -A AuthPassword -X CryptoPassword -l authNoPriv -u privUser localhost