SNMP – Sending Traps To Specific Hosts

By | December 30, 2021

I was noticed that We can send the traps to a specific host using version 2 while it is not happening with version 1.

I was tried to send BGP traps to one host, and PIM traps to another. As you can see below, BGP traps were getting sent to both hosts when I used version 1.

But traps were only sent to the specific host configured for BGP. I don’t know if this is difference in the protocols or versions.

You can see the below proof:

Version 1 sends trap to both hosts:

R1#sho run | inc snmp
snmp-server enable traps bgp
snmp-server enable traps pim
snmp-server host 2.2.2.2 public  bgp
snmp-server host 3.3.3.3 public  pim

R1#clear ip bgp *
R1#
00:11:49: %BGP-5-ADJCHANGE: neighbor 172.12.14.4 Down User reset
00:11:49: SNMP: Queuing packet to 2.2.2.2
 00:11:49: SNMP: V1 Trap, ent bgp, addr 172.12.12.1, gentrap 6, spectrap 2 
 bgpPeerEntry.14.172.12.14.4 = 00 00  
 bgpPeerEntry.2.172.12.14.4 = 1
00:11:49: SNMP: Queuing packet to 3.3.3.3
00:11:49: SNMP: V1 Trap, ent bgp, addr 172.12.13.1, gentrap 6, spectrap 2 
  bgpPeerEntry.14.172.12.14.4 = 00 00  
 bgpPeerEntry.2.172.12.14.4 = 1
00:11:49: SNMP: Packet sent via UDP to 2.2.2.2
00:11:49: SNMP: Packet sent via UDP to 3.3.3.3

Version 2c sends trap to specific host:

R1#sho run | inc snmp
snmp-server enable traps bgp
snmp-server enable traps pim
snmp-server host 2.2.2.2 version 2c public  bgp
snmp-server host 3.3.3.3 version 2c public  pim

R1#clear ip bgp *
R1#
00:13:09: %BGP-5-ADJCHANGE: neighbor 172.12.14.4 Down User reset
R1#
00:13:09: SNMP: Queuing packet to 2.2.2.2
00:13:09: SNMP: V2 Trap, reqid 21, errstat 0, erridx 0 
 sysUpTime.0 = 78967 
  snmpTrapOID.0 = bgpTraps.2 
 bgpPeerEntry.14.172.12.14.4 = 00 00  
 bgpPeerEntry.2.172.12.14.4 = 1
00:13:09: SNMP: Packet sent via UDP to 2.2.2.2
R1#

Thanks for reading the blog……..

Recommended links:

Leave a Reply

Your email address will not be published.