Net-SNMP installation and configuration
guide
net-snmp target version is 5.7 or 5.8
Installation
ubuntu
$ sudo apt install snmpd snmp libsnmp-dev snmp-mibs-downloader
fedora
$ sudo dnf install net-snmp net-snmp-utils net-snmp-devel
arch
$ sudo pacman -S net-snmp
mac
$ brew install net-snmp
Agent Configuration
stop the agent
linux:
$ sudo systemctl stop snmpd
1 of 6
creating a work dir - that is known by default to the snmpd
$ mkdir ~/.snmp
$ cd ~/.snmp
lets create and snmpd.conf file with the help of the snmpconf (read the
instrutions that it gives to you)
$ snmpconf
none
snmpd.conf
Access Control Setup
a SNMPv1/SNMPv2c read-write access community name
gr2020
localhost
(press enter)
finished
finished
quit
where do the config files reside?
$ net-snmp-config --snmpconfpath
e.g.: /etc/snmp/
backup the default configuration file
$ sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
copy the file to the snmpconfpath directory
$ sudo cp snmpd.conf /etc/snmp/
2 of 6
start the agent
linux:
$ sudo systemctl start snmpd
mac: (not tested)
$ sudo sudo launchctl load -w /System/Library/LaunchDaemons/org.net-
snmp.snmpd.plist
begin the agent at system startup (optional)
linux:
$ sudo systemctl enable snmpd
mac: (not tested - don't know if it is needed)
edit the file /etc/hostconfig
in the file, locate the line
APPLETALK_HOSTNAME
and add the following entry before APPLETALK_HOSTNAME
SNMPSERVER:=-YES-
Test it
checks the version
$ snmpwalk -V
checks if the agent is working
$ snmpwalk -v 2c localhost -c gr2020 .1.3.6.1.2.1.1
3 of 6
$ snmpwalk -v 2c localhost -c gr2020 system
see all your MIBs
$ snmpwalk -v 2c localhost -c gr2020 .1 | less
That command is too verbose for me - Manager
Configuration
lets create and snmp.conf file with the help of the snmpconf (read the
instrutions that it gives to you)
$ snmpconf
none
snmp.conf
Default Authentication Options
The default snmp version number to use
2c
The default snmpv1 and snmpv2c community name to use when needed
gr2020
finished
finished
quit
copy the file to the snmpconfpath directory
e.g.: /etc/snmp/
$ sudo cp snmp.conf /etc/snmp/
Test it
$ snmpwalk localhost system
4 of 6
Set your laptop location in "time and space"
set system.sysLocation.0
$ snmpset localhost system.sysLocation.0 s "planet earth?"
get system.sysLocation.0
$ snmpget localhost system.sysLocation.0
What is expected of you by the end of this course
you should be able to develop an snmp agent for something like this
5 of 6
Not really!!!
but for something like this, it's possible...
6 of 6