SNMP Traps – Complete Guide
1. What Is an SNMP Trap?
An SNMP Trap is an unsolicited, asynchronous message sent by a network device (the SNMP Agent) to an SNMP Manager whenever a predefined event occurs — such as an interface going down, a device rebooting, or CPU utilisation exceeding a threshold.
Unlike polling (where the manager periodically asks "how are you?"), traps are pushed immediately by the agent the moment the event happens. This makes them ideal for real-time alerting with minimal network overhead.
SNMP Agent (Router/Switch) SNMP Manager (SolarWinds/PRTG)
| |
| [Interface Gi0/1 goes DOWN at 14:32] |
| |
|-- TRAP: linkDown, Gi0/1 [UDP 162] ------>| Immediate alert — no polling needed
| |
| [Device reboots at 14:45] |
| |
|-- TRAP: coldStart [UDP 162] ------------>|
Related pages: show logging (Syslog) | ACL Overview | Applying ACLs | show running-config | NTP Synchronisation | Common Port Numbers | Step-by-Step: SNMP Configuration | Syslog Configuration Lab
2. SNMP Trap vs. Polling (GET Requests)
Understanding the difference between trap-based and poll-based monitoring is essential for both the CCNA exam and real-world network design.
| Feature | SNMP Trap | SNMP Polling (GET) |
|---|---|---|
| Direction | Agent → Manager (unsolicited) | Manager → Agent (requested) |
| Trigger | Event-based — sent when something happens | Scheduled/timed interval (e.g., every 5 min) |
| Network Load | Very low — only sent on events | Higher — continuous periodic polling |
| Latency | Immediate — sub-second alert | Up to one polling interval delay |
| Reliability | No acknowledgement — fire and forget | Confirmed response from agent |
| Best For | Real-time critical alerts (link failures, reboots) | Trending, capacity planning, baseline metrics |
In practice, both are used together: polling provides regular metrics, traps provide instant event notification.
3. SNMP Trap Types
A. Generic Traps (Defined in RFC 1157)
These are standard traps defined in the base SNMP MIB, supported by virtually all SNMP-capable devices:
| Trap Name | Trigger | Severity |
|---|---|---|
coldStart | Device has rebooted (full power cycle or crash) | Critical |
warmStart | Device has re-initialised without power cycling (software restart) | Warning |
linkDown | A network interface has transitioned to the "down" state | Critical |
linkUp | A network interface has transitioned to the "up" state | Informational |
authenticationFailure | Agent received a request with an unrecognised community string | Warning |
egpNeighborLoss | An EGP peer has gone down (legacy, rarely used) | Critical |
B. Specific (Enterprise) Traps
Vendor-defined traps extending beyond the generic set, defined in proprietary MIBs. Examples include:
- Cisco:
ciscoEnvMonTemperatureNotification(temperature alarm),cpmCPUTotalHigh(high CPU),bgpEstablished/bgpBackwardTransition(BGP state changes) - Juniper:
jnxLinkDown,jnxOspfNbrStateChange - Generic server:
hrDiskFull(disk space critical),hrProcessorLoad(CPU overload)
4. SNMP Trap Message Format
Every SNMP trap carries a standard set of fields that the manager uses to identify, log, and react to the event:
| Field | Description | Example |
|---|---|---|
| Agent IP Address | Source IP of the device sending the trap | 192.168.1.1 |
| Trap OID | Object Identifier identifying the trap type | IF-MIB::linkDown |
| Timestamp (sysUpTime) | Device uptime at the moment the trap was generated | 3 days, 14:32:05 |
| Variable Bindings (varbinds) | Additional context data — what interface, what value, etc. | ifIndex.1 = 1 |
| Community String | SNMPv1/v2c only — identifies the "community" for the manager | MyROString |
| Enterprise OID | SNMPv1 only — OID of the enterprise that defined the trap | enterprises.9 (Cisco) |
Example SNMPv2c linkDown trap as seen on the manager:
SNMPv2-MIB::snmpTrapOID.0 = OID: IF-MIB::linkDown
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifDescr.1 = STRING: GigabitEthernet0/0
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.1 = INTEGER: down(2)
5. Configuring SNMP Traps on Cisco IOS
Step 1 — Define the SNMP Trap Receiver (Manager)
Router(config)# snmp-server host 192.168.1.100 traps MyROString
This tells the router to send all enabled traps to the manager at 192.168.1.100 using community string MyROString over UDP port 162.
Step 2 — Enable Specific Trap Categories
Router(config)# snmp-server enable traps ! Enable all trap categories
Router(config)# snmp-server enable traps snmp linkdown ! Interface link-down traps only
Router(config)# snmp-server enable traps snmp linkup ! Interface link-up traps
Router(config)# snmp-server enable traps bgp ! BGP state-change traps
Router(config)# snmp-server enable traps config ! Configuration change traps
Step 3 — Verify the Configuration
Router# show snmp host
Router# show snmp
Router# show running-config | include snmp
Expected output of show snmp host:
Notification host: 192.168.1.100 udp-port: 162 type: trap
user: MyROString security model: v2c
Configuring SNMPv3 Traps (Recommended for Production)
Router(config)# snmp-server group SNMPGROUP v3 priv
Router(config)# snmp-server user SNMPUSER SNMPGROUP v3 auth sha AuthPass priv aes 128 PrivPass
Router(config)# snmp-server host 192.168.1.100 version 3 priv SNMPUSER
6. SNMP Trap Ports & Protocols
| Port | Protocol | Direction | Purpose |
|---|---|---|---|
| UDP 161 | UDP | Manager → Agent | Standard SNMP polling (GET, SET, GETBULK) |
| UDP 162 | UDP | Agent → Manager | SNMP Traps and Informs received by the manager |
Why UDP? SNMP uses UDP (connectionless) because SNMP operations are simple request-response messages. UDP adds no connection overhead — if a response is needed, the application layer handles retries. For traps, UDP is acceptable because traps are best-effort; if reliability is needed, use Informs instead (see Section 9).
Ensure UDP 162 is open inbound on the SNMP Manager's firewall from your managed devices. See ACL/Firewall and Applying ACLs for guidance.
7. Trap Severity Levels
While SNMP traps do not have built-in severity levels like Syslog, Network Management Systems typically classify them by impact:
| Severity | Example Traps | Typical NMS Action |
|---|---|---|
| Critical | linkDown, coldStart, bgpBackwardTransition | Page on-call engineer, open ticket, trigger failover |
| Warning | authenticationFailure, cpmCPUTotalHigh | Email/Slack alert, log for investigation |
| Informational | linkUp, configChange, warmStart | Log only, dashboard indicator |
8. SNMPv1 vs v2c vs v3 Traps
| Feature | SNMPv1 | SNMPv2c | SNMPv3 |
|---|---|---|---|
| Authentication | Community String | Community String | User-based (SHA/MD5) |
| Encryption | None | None | AES or DES |
| Trap Format | Basic — uses generic/enterprise trap PDU | Enhanced — uses snmpV2-trap PDU with varbinds | Same as v2c + security wrapper |
| Acknowledgement | No | No (Inform adds acknowledgement) | No (Inform adds acknowledgement) |
| Recommended | Legacy/lab only | Acceptable for internal-only management networks | All production environments |
The key structural difference: SNMPv1 traps use a legacy PDU type with fixed fields (generic-trap, specific-trap, time-stamp). SNMPv2c and v3 use the snmpV2-trap PDU which carries all information as variable bindings — more flexible and extensible.
9. SNMP Trap vs. Inform
SNMPv2c introduced Inform messages as a more reliable alternative to traps for critical events:
| Feature | Trap | Inform |
|---|---|---|
| Acknowledgement | No — fire and forget | Yes — manager must send a GetResponse |
| Reliability | Low — if manager is busy or packet is lost, trap is gone | High — agent retries until acknowledged or retry limit reached |
| Network Load | Lower | Higher (retransmissions) |
| Use Case | Non-critical notifications, high-frequency events | Critical events where guaranteed delivery is required |
| SNMP Version | v1, v2c, v3 | v2c and v3 only |
Configuring Informs on Cisco IOS:
Router(config)# snmp-server host 192.168.1.100 informs MyROString
10. MIBs for Traps
Every SNMP trap is identified by an OID defined in a MIB (Management Information Base). The manager must have the correct MIB loaded to decode and display the trap meaningfully.
| MIB | Defines | Common Traps |
|---|---|---|
SNMPv2-MIB | Core SNMP objects | coldStart, warmStart, authenticationFailure |
IF-MIB | Network interfaces | linkDown, linkUp |
BGP4-MIB | BGP routing protocol | bgpEstablished, bgpBackwardTransition |
CISCO-PROCESS-MIB | Cisco CPU/process stats | cpmCPUTotalHigh |
HOST-RESOURCES-MIB | Server resources | hrDiskFull, hrProcessorLoad |
Import vendor-specific MIBs into your NMS (SolarWinds, PRTG, Zabbix) to ensure enterprise traps are decoded correctly. Without the MIB, the NMS will display raw OIDs rather than readable trap names.
11. Testing SNMP Traps
Sending a Test Trap from Linux
snmptrap -v 2c -c public 192.168.1.100 '' IF-MIB::linkDown ifIndex.1 i 1
-v 2c— SNMP version-c public— Community string192.168.1.100— Manager IP (trap destination)IF-MIB::linkDown— Trap OIDifIndex.1 i 1— Variable binding: interface index 1
Listening for Traps on the Manager (Linux)
snmptrapd -f -Lo
This runs snmptrapd in the foreground (-f) with output logged to stdout (-Lo). Press Ctrl+C to stop. Incoming traps will be printed in real time.
Triggering a Real Trap on a Cisco Device
! Shut down an interface to generate a linkDown trap
Router(config)# interface GigabitEthernet0/1
Router(config-if)# shutdown
12. Security Considerations
SNMP traps carry sensitive operational data about your network. Without proper controls, traps can be intercepted, spoofed, or used to flood a manager.
- ✅ Use SNMPv3 with
authPriv— traps are authenticated and encrypted - ✅ Apply ACLs to restrict which devices can send traps to your manager: only permit UDP 162 from known agent IPs
- ✅ Apply ACLs on the Cisco device to restrict which manager IPs receive traps
- ✅ Monitor for excessive
authenticationFailuretraps — a spike may indicate a brute-force or misconfiguration
! Restrict which manager receives traps using an ACL
Router(config)# access-list 10 permit 192.168.1.100
Router(config)# snmp-server host 192.168.1.100 traps MyROString
13. Common Use Cases
| Device / System | Trap | Business Value |
|---|---|---|
| Core router / switch | linkDown, coldStart | Immediate awareness of network outages |
| BGP edge router | bgpBackwardTransition | Detect ISP or peer connectivity failure in seconds |
| Server | hrDiskFull, hrProcessorLoad | Prevent service outages from resource exhaustion |
| Any device | authenticationFailure | Detect SNMP brute-force or misconfigured manager |
| Any device | configChange | Audit trail for configuration changes |
14. Monitoring Traps in Popular NMS Platforms
- SolarWinds NPM: Built-in Trap Viewer with alert generation, filtering, and escalation rules. Supports MIB import for enterprise traps.
- PRTG: SNMP Trap Receiver sensor — configure a sensor on the manager to receive and classify traps by OID pattern.
- Zabbix: Native SNMP trap support via
snmptrapdintegration. Trap-to-trigger mapping using OID patterns. - ELK Stack: Integrate traps via Logstash SNMP input plugin, store in Elasticsearch, visualise in Kibana for historical analysis.
15. Troubleshooting SNMP Traps
| Problem | Likely Cause | Fix |
|---|---|---|
| Manager not receiving traps | snmp-server host not configured, UDP 162 blocked | Verify show snmp host; open UDP 162 on manager firewall |
| Traps received but unreadable OIDs | MIB not loaded in NMS | Download and import the vendor MIB file into your NMS |
| Wrong community string on trap | String mismatch between agent and manager | Match the string in snmp-server host with NMS configuration |
| Authentication failure traps flooding manager | Monitoring tool using wrong community string | Verify the NMS community string; update as needed |
16. Summary
- SNMP Traps = Real-time, event-driven alerts pushed by the agent to the manager over UDP 162
- Generic traps (coldStart, linkDown, authenticationFailure) are defined in standard MIBs; enterprise traps are vendor-specific
- Trap vs Inform: Traps are unreliable (fire-and-forget); Informs add acknowledgement and retry — use Informs for critical events
- Configuration: Define
snmp-server host, enable trap types withsnmp-server enable traps - Security: Use SNMPv3 with
authPrivand ACLs to protect trap delivery - Test: Use
snmptrapto send andsnmptrapdto receive test traps on Linux