Basic SNMP Configuration
Basic SNMP Configuration
Section titled “Basic SNMP Configuration”TL;DR (Quick Start)
Section titled “TL;DR (Quick Start)”For the impatient: here’s the 30-second version.
# Enable SNMP with read-only community/snmp set enabled=yes/snmp community add name=public addresses=192.168.88.0/24 read-access=yes write-access=noOverview
Section titled “Overview”This guide demonstrates how to configure SNMP on MikroTik RouterOS for network monitoring.
Prerequisites
Section titled “Prerequisites”- A MikroTik router running RouterOS 7.x or later
- Access to the router via SSH, WinBox, or WebFig
Configuration Steps
Section titled “Configuration Steps”Step 1: Enable SNMP
Section titled “Step 1: Enable SNMP”Enable the SNMP service with basic settings:
Step 2: Create an SNMP Community
Section titled “Step 2: Create an SNMP Community”Create a read-only SNMP community:
/snmp community add name=monitoring addresses=192.168.88.0/24 read-access=yes write-access=no comment="Monitoring system"Step 3: Create a Write Community
Section titled “Step 3: Create a Write Community”Create a community with write access for management:
/snmp community add name=management addresses=192.168.88.10/32 read-access=yes write-access=yes comment="SNMP management"Verification
Section titled “Verification”Check 1: SNMP Service Status
Section titled “Check 1: SNMP Service Status”/snmp printExpected Output:
enabled: yes contact: [email protected] location: Server Room A engine-id: trap-target: trap-community: public trap-version: 1 trap-generators:Check 2: SNMP Communities
Section titled “Check 2: SNMP Communities”/snmp community printExpected Output:
Flags: * - default, X - disabled # NAME ADDRESSES SECURITY READ-ACCESS WRITE-ACCESS 0 * public none yes no 1 monitoring 192.168.88.0/24 none yes no 2 management 192.168.88.10/32 none yes yesCheck 3: Test SNMP (from monitoring system)
Section titled “Check 3: Test SNMP (from monitoring system)”# From Linux/monitoring serversnmpwalk -v2c -c monitoring 192.168.88.1 systemTroubleshooting
Section titled “Troubleshooting”Problem: SNMP queries not working
Section titled “Problem: SNMP queries not working”Symptoms: Monitoring system cannot poll router, snmpwalk times out.
Causes & Solutions:
-
Source IP not allowed - Check community addresses:
/snmp community printAdd monitoring server IP to allowed addresses.
-
Wrong community string - Verify community name matches exactly (case-sensitive).
-
SNMP service disabled - Enable SNMP:
/snmp set enabled=yes -
Firewall blocking SNMP - Allow UDP 161 from monitoring network:
/ip firewall filter add chain=input action=accept protocol=udp dst-port=161 src-address=192.168.88.0/24
Problem: SNMP traps not received
Section titled “Problem: SNMP traps not received”Symptoms: Monitoring system doesn’t receive SNMP traps.
Causes & Solutions:
-
Trap target not configured:
/snmp set trap-target=192.168.88.50 -
Trap generators not enabled:
/snmp set trap-generators=interfaces,start-trap -
Firewall blocking outbound traps - Allow UDP 162 outbound.
Problem: Write access not working
Section titled “Problem: Write access not working”Symptoms: Cannot modify router via SNMP SET commands.
Causes & Solutions:
-
Community has no write access:
/snmp community printEnsure
write-access=yesfor the community. -
Using SNMPv1 - Some write operations require SNMPv2c or v3.
Problem: High CPU during SNMP polling
Section titled “Problem: High CPU during SNMP polling”Symptoms: Router CPU spikes during SNMP queries.
Causes & Solutions:
-
Polling too frequently - Reduce polling interval on monitoring system.
-
Polling too many OIDs - Query only needed OIDs rather than walking entire MIB.
-
Many concurrent queries - Stagger polling from multiple monitoring systems
Related Topics
Section titled “Related Topics”Security
Section titled “Security”- Firewall Basics - restrict SNMP access by IP
- User Management - SNMPv3 authentication
Monitoring Integration
Section titled “Monitoring Integration”- Logging - SNMP traps complement logging
- Graphing - built-in graphing alternative
- Torch - real-time traffic monitoring
Advanced Usage
Section titled “Advanced Usage”- Scheduler - scheduled SNMP queries via scripts