Watch a router: measure how busy port Gi0/2 is, then catch the alarm when it fails.
What is SNMP?
SNMP — Simple Network Management Protocol — is how a monitoring server keeps an eye on routers, switches and servers. It asks them questions such as “how much traffic?” on UDP port 161, and they can raise an alarm of their own on port 162.
- 1Pick a story
Start with “Watch a router”. “Keep it private” shows the secure version.
- 2Press Next
One message at a time travels between the two machines.
- 3Read what happened
Switch to Technical or Packet whenever you want more detail.
- 4Try it for real
Every step shows the command that sends the same message.
10.0.0.50asks the questions10.0.0.1answers, and raises alarmsA monitoring server wants to keep an eye on a router. Press Next to send its first question.
The server knows the router’s address and one shared password, “public”. With SNMPv2c that is all it needs — and anyone else who sees that password can ask too.
The server wants to know how long the router has been up. What kind of message does it send?
See the real packetfields and values appear once a message is sent
nms 10.0.0.50 · agent 10.0.0.1:161 · community public · poll interval 60 s
Practise on your own computer5 steps · Ubuntu, or Windows with WSL
Practise only on your own computer, or on devices you have permission to test. The agent set up here listens on 127.0.0.1, so nothing outside your computer can reach it.
- 1Open a Linux terminal
On Windows, open PowerShell as administrator, run this, restart, then open “Ubuntu” from the Start menu. Already on Ubuntu? Skip this step.
wsl --install - 2Install the tools, the agent and the trap receiver
snmp gives you snmpget and the other commands, snmpd is the agent that answers them, and snmptrapd receives alarms.
sudo apt updatesudo apt install -y snmp snmpd snmptrapd - 3Let the agent share its interface counters
Out of the box the agent answers only on 127.0.0.1 and shares only basic system information. This one line adds the interface table.
echo 'view systemonly included .1.3.6.1.2.1.2' | sudo tee -a /etc/snmp/snmpd.confsudo service snmpd restart - 4Create the SNMPv3 user nms-ro
The agent has to be stopped while its user file is edited, and each password needs at least 8 characters.
sudo service snmpd stopecho 'createUser nms-ro SHA-256 "authpass123" AES "privpass123"' | sudo tee -a /var/lib/snmp/snmpd.confecho 'rouser nms-ro priv' | sudo tee -a /etc/snmp/snmpd.confsudo service snmpd start - 5Allow the lab’s traps
The trap receiver drops every alarm until it is told which community to accept. Stopping the background copy frees port 162 for the one you start by hand.
echo 'authCommunity log public' | sudo tee -a /etc/snmp/snmptrapd.confsudo service snmptrapd stop
Done — now pick any step above and run its command.
Watch a router: measure how busy port Gi0/2 is, then catch the alarm when it fails.
- Why is SNMPv2c risky on a network you don’t trust?
- How is the 45 Mbit/s traffic rate worked out?
Read it now and keep it in mind — the answer is in what you are about to watch.