Sending SNMP Traps
  • 10 Jul 2024
  • 4 Minutes to read
  • Contributors
  • PDF

Sending SNMP Traps

  • PDF

Article summary

Configuring SNMP Agent for Trap and Inform Message Generation


SNMP Agent generates SNMP trap messages Agent to notify the SNMP Manager about the events happening in the system. The following example shows, how to configure a SNMP Manager to send trap messages.

Configuration Guidelines

To configure SNMP Agent

  1. In SNMP Agent, configure SNMP Manager to be part of Target address list.
  2. Configure SNMP parameters (Target Params) to be used, when generating messages to the SNMP MManager.
  3. Select the target address list (which includes SNMP manger) to receive notifications.

Default Configurations

None

Configuration Steps

Host1 needs to be configured as an SNMP Manager for switch 1 and needs to be verified, if the SNMP trap messages are sent to the host after the configurations are done in the switch.

  1. Configure an IP interface available for management in switch1. Execute the following commands in SNMP Agent to configure vlan 1 and associate Port 1 to it. Also, verify the VLAN configurations.
    Your Product# configure terminal
    Your Product(config)# vlan 1
    Your Product(config-vlan)# ports xl-ethernet 0/1 untagged xl-ethernet 0/1
    Your Product(config-vlan)# exit
    Your Product(config)# interface xl-ethernet 0/1
    Your Product(config-if)# switchport pvid 1
    Your Product(config-if)# exit
    Your Product(config)# interface vlan 1
    Your Product(config-if)# shutdown
    Your Product(config-if)# ip address 12.0.0.1 255.0.0.0
    Your Product(config-if)# no shutdown
    Your Product(config-if)# end
    Your Product# show ip interface
    vlan1 is up, line protocol is up
    Internet Address is 12.0.0.1/8
    Broadcast Address 12.255.255.255
    Your Product# show vlan brief
    Vlan database


    Vlan ID : 1
    Member Ports : Gi0/1
    Untagged Ports : Gi0/1
    Forbidden Ports : None
    Name :
    Status : Permanent

  2. Configure the SNMP Manager (12.0.0.100) address to be available in the SNMP Agent target address list and configure the target parameters for this target address entry.

Your Product# configure terminal
Your Product(config)# snmp targetaddr ht231 param pa231 12.0.0.100 taglist tg231 nonvolatile
Your Product(config)# snmp targetparams pa231 user u231 security-model v2c message-processing v2c nonvolatile
Your Product(config)# end
  1. View the target parameter configuration using the show commands.
Your Product# show snmp targetaddr

Target Address Name : ht231
IP Address : 12.0.0.100
Tag List : tg231
Parameters : pa231
Storage Type : Non-volatile
Row Status : Active

-----------------
Your Product# show snmp targetparam
Target Parameter Name : internet
Message Processing Model : v2c
Security Model : v2c
Security Name : none
Security Level : No Authenitcation, No Privacy
Storage Type : Non-volatile
Row Status : Active

-----------------

Target Parameter Name : pa231
Message Processing Model : v2c
Security Model : v2c
Security Name : u231
Security Level : No Authenitcation, No Privacy
Storage Type : Non-volatile
Row Status : Active

-------------------------

Target Parameter Name : test1
Message Processing Model : v2c
Security Model : v1
Security Name : none
Security Level : No Authenitcation, No Privacy
Storage Type : Non-volatile
Row Status : Active

----------------------

  1. For SNMP V1 and V2 configure the community security name. Targetparams user name and community security name should be equal.
Your Product# configure terminal
Your Product(config)# snmp community index PUBLIC name PUBLIC security u231
Your Product(config)# end
  1. View the community configuration using the show commands.
Your Product# show snmp community

Community Index : NETMAN
Community Name : NETMAN
Security Name : none
Context Name :
Context EngineID: 80.00.08.1c.04.46.53
Transport Tag :
Storage Type : Non-volatile
Row Status : Active

-----------------
Community Index : PUBLIC
Community Name : PUBLIC
Security Name : u231
Context Name :
Context EngineID: 80.00.08.1c.04.46.53
Transport Tag :
Storage Type : Non-volatile
Row Status : Active

---------------

  1. Configure the notification type as trap message.
Your Product(config)# snmp notify PUBLIC tag tg231 type trap nonvolatile
  1. Execute the following command to view the configuration of the notification type.
Your Product# show snmp notif

Notify Name : PUBLIC
Notify Tag : tg231
Notify Type : trap
Storage Type : Non-volatile
Row Status : Active

--------------------

Notify Name : Your Product
Notify Tag : Your Product
Notify Type : trap
Storage Type: Volatile
Row Status : Active

------------------
Notify Name : Your Product1
Notify Tag : Your Product1
Notify Type : trap
Storage Type : Volatile
Row Status : Active

----------------

  1. Observe the SNMP trap notification message (Link-UP trap message) sent to the SNMP Manager (12.0.0.100) when the Port 2 is made up.
Your Product# configure terminal
Your Product(config)# interface xl-ethernet 0/2
Your Product(config-if)# no shutdown
Your Product(config-if)# end


At Manager:

Configure net-SNMP to allow reception and logging of SNMP trap messages by giving the command:

#snmptrapd

Observe SNMP trap messages are properly logged in the following file /var/log/messages.

Enabling Authentication Traps

Authentication traps are disabled by default. This trap is sent to the SNMP Manager for v1/v2 messages. Hence community must be configured. Community com1 is not shown here, as it is already configured.

  1. Enable authentication traps in the SNMP Agent.
    Enter into the Global Configuration Mode.
Your Product# configure terminal

Enable the authentication traps.

Your Product(config)# snmp-server enable traps snmp authentication

Exit from the Global Configuration Mode.

Your Product(config)# end


At Manager:

Configure net-SNMP to allow reception and logging of SNMP trap messages by giving the command:

#snmptrapd
#snmpwalk -v 2c -c com3 12.0.0.1 1

The authentication fails as the community is configured as com1 for processing the v1/v2 requests in the SNMP Agent. The authentication fails, if the v2 request is sent with community identity as com3, and the SNMP Agent sends the trap.

Observe SNMP trap messages are properly logged in the following file /var/log/messages.

© 2024 Cisco and/or its affiliates. All rights reserved.
 
For more information about trademarks, please visit: Cisco trademarks
For more information about legal terms, please visit: Cisco legal terms

For legal information about Accedian Skylight products, please visit: Accedian legal terms and tradmarks



Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.