This document describes how to configure supported Cisco IOS® SNMP Traps.
Cisco recommends that you have knowledge of these topics:
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Refer to the Cisco Technical Tips Conventions for more information on document conventions.
When working with SNMP, it is recommended to limit the number of traps enabled on a Cisco device to prevent excessive traffic. For example, enabling all traps on a Remote Access Server with 64 dial-in lines would generate a trap for every connection and disconnection event, which can quickly overwhelm your monitoring system. Cisco IOS Software allows you to configure specific groups of traps to enable or disable, which helps manage trap volume effectively. There are two global configuration commands to configure SNMP traps into a Cisco IOS Software device:
snmp-server host host-addr [traps | informs] [version {1 | 2c | 3 [auth | noauth | priv]}]
community-string [udp-port port] [notification-type]
Issue the snmp-server host global configuration command to specify the recipient of an SNMP notification operation. Issue the no form of this command to remove the specified host.
snmp-server enable traps [notification-type] [notification-option]
Issue the snmp-server enable traps global configuration command to enable the router to send SNMP traps. Issue theno form of this command to disable SNMP notifications.
The types of traps can be specified in both commands. You must issue the snmp-server host command to define the Network Management Systems where traps are sent. You must specify the trap types if you do not want all traps sent. Issue multiple snmp-server enable traps commands, one for each of the trap types that you used in the snmp host command.
For example, issue these commands to make a Cisco IOS Software device report only configuration, Border Gateway Protocol (BGP), and tty traps to Network Management System 10.10.10.10:
snmp-server host 10.10.10.10 public config bgp tty snmp-server enable traps config snmp-server enable traps bgp
Cisco devices that run the standard Cisco IOS Software (routers, Asynchronous Transfer Mode (ATM) switches, and Remote Access Servers) can generate many SNMP traps.
snmp-server-host CommandIssue the snmp-server host global configuration command to specify the recipient of an SNMP notification operation. Issue the no form command to remove the specified host.
snmp-server host host-addr [traps | informs] [version {1 | 2c | 3 [auth | noauth | priv]}] community-string [udp-port port] [notification-type] no snmp-server host host [traps | informs]
host-addr |
The name or Internet address of the host (the targeted recipient). |
traps |
(Optional) Send SNMP traps to this host; this is the default. |
informs |
(Optional) Send SNMP informs to this host. |
version |
(Optional) The version of the SNMP used to send the traps. Version 3 is the most secure model, as this model allows packet encryption with the priv keyword. If you use the version keyword, you must specify one of these options:
|
community-string |
The password-like community string sent with the notification operation. Though you can set this string with the snmp-server host command by itself, Cisco recommends that you define this string with the snmp-server community command before you issue the snmp-server host command. |
udp-portport |
User Datagram Protocol (UDP) port of the host to use; the default is 162. |
| notification-type | (Optional) The type of notification to be sent to the host. If no type is specified, all notifications are sent. The notification type can be one or more of these keywords:
|
The snmp-server host command is disabled by default and no notifications are sent.
If you enter this command with no keywords, the default is to send all trap types to the host.
No informs are sent to this host. If no version keyword is present, the default is version 1. The no snmp-server host command with no keywords disables traps, but not informs to the host. Issue the no snmp-server host informs command to disable informs.
| Cisco IOS Software Release | Modification |
|---|---|
| 10.0 | Command introduced. |
| 12.0(3)T | These keywords have been added:
|
SNMP notifications can be sent as traps or inform requests. Traps are unreliable because the receiver does not send acknowledgments when this device receives traps. The sender cannot determine if the traps were received. However, an SNMP entity that receives an inform request acknowledges the message with an SNMP response protocol data unit (PDU). If the sender never receives the response, the inform request can be sent again. Therefore, informs are more likely to reach their intended destination.
However, informs consume more resources in the agent and in the network. Unlike a trap, which is discarded as soon as it is sent, an inform request must be held in memory until a response is received, or the request times out. Traps are sent only once, while an inform can be retried several times. The retries increase traffic and contribute to a higher overhead on the network.
If you do not enter an snmp-server host command, no notifications are sent. To configure the router to send SNMP notifications, you must enter at least one snmp-server host command. If you enter the command with no keywords, all trap types are enabled for the host. To enable multiple hosts, you must issue a separate snmp-server host command for each host. You can specify multiple notification types in the command for each host.
When multiple snmp-server host commands are given for the same host and notification (trap or inform), each command overwrites the previous command. Only the last snmp-server host command is taken into account. For example, if you enter an snmp-server host inform command for a host and then enter another snmp-server host inform command for the same host, the second command replaces the first.
The snmp-server host command is used in conjunction with the snmp-server enable command. Issue the snmp-server enable command to specify which SNMP notifications are sent globally. In order for a host to receive the most notifications, at least one snmp-server enable command and the snmp-server host command for that host must be enabled.
However, some notification types cannot be controlled with the snmp-server enable command. For example, some notification types are always enabled. Other notification types are enabled by a different command. For example, the linkUpDown notifications are controlled by the snmp trap link-status command. These notification types do not require an snmp-server enable command.
The availability of a notification-type option depends on the router type and Cisco IOS software features supported on the router. For example, the envmon notification-type is available only if the environmental monitor is part of the system.
Complete these steps to send an inform:
Configure a remote engine ID.
Configure a remote user.
Configure a group on a remote device.
Enable traps on the remote device.
Enable the SNMP manager.
To configure a unique SNMP community string for traps, but you want to prevent SNMP polling access with this string, the configuration must include an access-list. In this example, the community string is named comaccess, and the access list is numbered 10:
snmp-server community comaccess ro 10 snmp-server host 172.20.2.160 comaccess access-list 10 deny any
This example sends the SNMP traps to the host specified by the name myhost.cisco.com. The community string is defined as comaccess:
snmp-server enable traps snmp-server host myhost.cisco.com comaccess snmp
This example sends the SNMP and Cisco environmental monitor enterprise-specific traps to address 172.30.2.160:
snmp-server enable traps snmp-server host 172.30.2.160 public snmp envmon
This example enables the router to send all traps to the host myhost.cisco.com with the community string public:
snmp-server enable traps snmp-server host myhost.cisco.com public
This example does not send traps to any host. The BGP traps are enabled for all hosts, but only the ISDN traps are enabled to send to a host.
snmp-server enable traps bgp snmp-server host bob public isdn
This example enables the router to send all inform requests to the host myhost.cisco.com with the community string public:
snmp-server enable traps snmp-server host myhost.cisco.com informs version
This example sends HSRP SNMPv2c traps to the host specified by the name myhost.cisco.com. The community string is defined as public.
snmp-server enable traps snmp-server host myhost.cisco.com traps version 2c public hsrp
snmp-server enable traps CommandUse the snmp-server enable traps global configuration command to enable the router to send SNMP traps. Use the no form of this command to disable SNMP notifications.
snmp-server enable traps [notification-type] [notification-option] no snmp-server enable traps [notification-type] [notification-option]
| notification-type | (Optional): The type of notification to enable. If no type is specified, all notifications are sent (that includes the envmon and repeaternotifications). The notification type can be one of these keywords:
|
| notification-option | (Optional)
|
SNMP notifications are disabled.
If you enter this command with no notification-type keywords, the default is to enable all notification types controlled by this command.
| Cisco IOS Software Release | Modification |
|---|---|
| 11.1 | This command was introduced. |
| 12.0(2)T | Thersvpkeyword was added. |
| 12.0(3)T | The hsrp keyword was added. |
| 12.1(3)T | These keywords have been added to thesnmp-server enable traps snmp form of this command:
|
The snmp-server enable traps snmp [ linkup] [linkdown] form of this command replaces the snmp trap link-status interface configuration mode command.
The no form of the snmp-server enable traps command is useful to disable notifications that generate a large amount of unnecessary noise on your network.
SNMP notifications can be sent as traps or inform requests. This command enables both traps and inform requests for the specified notification types.
If you do not enter an snmp-server enable traps command, no notifications controlled by this command are sent. To configure the router to send these SNMP notifications, you must enter at least one snmp-server enable traps command. If you enter the command with no keywords, all notification types are enabled. If you enter the command with a keyword, only the notification type related to that keyword is enabled. To enable multiple types of notifications, you must issue a separate snmp-server enable traps command for each notification type and notification option.
The snmp-server enable traps command is used in conjunction with the snmp-server host command. Issue the snmp-server host command to specify which host or hosts receive SNMP notifications. To send notifications, you must configure at least one snmp-server host command.
For a host to receive a notification controlled by this command, both the snmp-server enable traps command and the snmp-server host command for that host must be enabled. If the notification type is not controlled by this command, only the appropriate snmp-server host command must be enabled.
The notification types used in this command all have an associated MIB object that allows them to be enabled or disabled (for example, HSRP traps are defined with the HSRP MIB, repeater traps are defined with the Repeater Hub MIB, and so on). Not all of the notification types available in the snmp-server host command have notificationEnable MIB objects, so, some of these cannot be controlled with the snmp-server enable command.
| Revision | Publish Date | Comments |
|---|---|---|
4.0 |
01-Jun-2026
|
Updated spelling, grammar, sentence structure, etc. |
3.0 |
18-Dec-2023
|
Recertification |
1.0 |
10-Dec-2001
|
Initial Release |