Restu Oktafiandi
Published Blog · 4 min read · October 12, 2024
In this guide, we’ll walk you through the steps to install SNMP (Simple Network Management Protocol) on a virtual machine (VM), covering multiple operating systems. SNMP is a widely used protocol for monitoring and managing devices in a network, and setting it up in a VM can help you monitor network devices or simulate network environments.
SNMP is a protocol used for network management. It helps administrators manage network performance, find and solve network issues, and plan for network growth. SNMP works by sending data (known as SNMP messages) between network devices and a central management system.
Before installing SNMP, it’s crucial to configure your virtual machine’s network settings to use bridged networking mode. This allows the VM to be on the same network as your host machine and other physical devices. In bridged mode, the VM acts like a physical machine, receiving its own IP address from the network’s DHCP server.
sudo apt update
sudo apt install snmp snmpd
sudo nano /etc/snmp/snmpd.conf
Find the line that starts with agentAddress and change it to
agentAddress udp:161,udp6:[::1]:161
Change the community string from public
to something more secure (e.g., your_community_string):
rocommunity your_community_string
sudo systemctl restart snmpd
sudo systemctl status snmpd
The command snmpwalk -v 2c -c your_community_string localhost
is used to test an SNMP (Simple Network Management Protocol) setup. It performs a walk through SNMP objects on a local machine (localhost), using version 2c (-v 2c) and the specified community string (-c your_community_string) to retrieve data. This helps in verifying SNMP configurations and ensuring that the system responds to SNMP queries.
If the community string is "public," the command would look like this
snmpwalk -v 2c -c public localhost