https://github.com/opennms-forge/opennms-install
In Ubuntu, install SNMP:
sudo apt install snmp snmpd snmp-mibs-downloader
There are two files that look nearly identical:
/etc/snmp/snmp.conf: This is for the client (thesnmpwalktool). It doesn't understand "agentAddress" or "rocommunity"./etc/snmp/snmpd.conf: (Note the 'd') This is for the daemon (the background service). This is where your settings belong.
-
Edit the Daemon Config: Open this file:
sudo vim /etc/snmp/snmpd.conf -
Add your configuration there:
agentAddress udp:161,udp6:[::1]:161rocommunity public 192.168.1.0/24(Adapt this range according to your network)(When using a subnet like
192.168.1.0/24, any device on that network, including OpenNMS, can read it.). You can also replace this range with the IP address of your OpenNMS server
After saving the file (Ctrl+O, Enter, Ctrl+X), restart the daemon:
sudo systemctl restart snmpd
If you still get "Timeout," it’s usually one of two things:
- The Firewall: Ubuntu’s
ufwmight be blocking port 161.sudo ufw allow 161/udp
Optional: Add other services like HTTP(S), SSH, (S)FTP, depending of your needs.
- Binding Issue: Run
netstat -tulpen | grep 161to make sure the service is actually listening on0.0.0.0:161and not just127.0.0.1.
Restart UFW:
sudo ufw reload
(Or start it with sudo ufw enable if used for the first time)
Run the walk again, but try it locally first to ensure the service is healthy:
snmpwalk -v2c -c public localhost system
If that works, try it from your OpenNMS machine using the Ubuntu IP.