Notes - SNMP Traps
SNMP notifications are unsolicited messages to an NMS. There are two types of SNMP notifications: traps and informs. A trap is not acknowledged, and an inform requires an acknowledge.
Generally, traps are preferred over informs. Traps use less resources, because informs must be held in memory in case they must be retransmitted due to being un-acknowledged.
IOS-XE
On IOS-XE, we enable SNMP notifications using the following command. This is required for both traps and informs. Trap types such as aaa_server, config, cpu, etc. can be used. If you do not specify anything, all traps are enabled.
snmp-server enable traps [trap type]
Next you must configure at least one NMS to receive the traps using the following configuration:
snmp-server host 1.1.1.1 traps|informs version <SNMP version> [trap types]
To disable SNMP linkup/linkdown notifications on a per-interface basis we use:
int Gi3
no snmp trap link-status
The source interface for traps can be set using:
snmp-server trap-source interface
Example 1
snmp-server enable traps snmp linkdown linkup
snmp-server enable traps config
snmp-server host 155.1.146.101 version 2c CISCO
Above, we limit what events can generate SNMP notifications using the “snmp-server enable traps” command. Then we enable traps to be sent to the NMS at 155.1.146.101 using the v2c community CISCO. Note that by default traps are enabled for a host, which is why the “traps” keyword is not used.
We can verify using show snmp host:

Example 2
snmp-server enable traps
snmp-server host 155.1.146.101 version 2c CISCO config snmp
In this example, we enable all traps but limit the trap types on a per-NMS basis.
Note that this will fill your config with many lines of snmp-server enable trap commands.

IOS-XR
Configuration appears to be extremely similar for IOS-XR. The only difference I see is that you use the syntax “snmp-server traps” instead of “snmp-server enable traps.”
Additionally, to disable SNMP notifications for linkup/linkdown on a per-interface basis, you use:
snmp-server interface GigabitEthernet0/0/0/0
notification linkupdown disable
Example
snmp-server host 1.1.1.1 traps version 2c CISCO
snmp-server traps snmp linkup
snmp-server traps snmp linkdown

Last updated