Configuring SNMP

The SNMP agent provides read-only access in this release.
Procedure
  1. SNMP is not enabled on the switch by default, unless the user enables it over any available VRF or with the default/mgmt VRF using the command snmp-server vrf <NAME>. For example, use the command snmp-server vrf mgmt to enable SNMP on the management interface. Use the command snmp-server vrf default to enable SNMP on the default VRF. Use the command snmp-server vrf <USERDEFINED_VRF_NAME> to enable SNMP on the user created VRF.
  2. Set the system contact, location, and description for the switch with the following commands:
    • snmp-server system-contact

    • snmp-server system-location

    • snmp-server system-description

  3. If required, change the default SNMP port on which the agent listens for requests with the command snmp-server agent-port.
  4. By default, the agent uses the community string public to protect access through SNMPv1/v2c. Set a new community string with the command snmp-server community.
  5. Configure the trap receivers to which the SNMP agent will send trap notifications with the command snmp-server host.
  6. Create an SNMPv3 context and associate it with any available SNMPv3 user to perform context specific v3 MIB polling using the command snmpv3 user <V3_USERNAME> context <CONTEXT_NAME>.
  7. Create an SNMPv3 context and associate it with an available SNMPv1/v2c community string to perform context specific v1/v2c MIB polling using the command snmpv3 context <CONTEXT_NAME> vrf <VRF_NAME> community <COMMUNITY_NAME>.
  8. Review your SNMP configuration settings with the following commands:
    • show snmp agent-port

    • show snmp community

    • show snmp system

    • show snmpv3 context

    • show snmp trap

    • show snmp vrf

    • show snmpv3 users

    • show tech snmp

Example 1

This example creates the following configuration:

  • Enables SNMP on the out-of-band management interface (VRF mgmt).
  • Sets the contact, location, and description for the switch to: JaniceM, Building2, LabSwitch.
  • Sets the community string to Lab8899X.
switch(config)# snmp-server vrf mgmt
switch(config)# snmp-server system-contact JaniceM
switch(config)# snmp-server system-location Building2
switch(config)# snmp-server system-description LabSwitch 
switch(config)# snmp-server community Lab8899X
Example 2

This example creates the following configuration:

  • Creates an SNMPv3 user named Admin using sha authentication with the plaintext password mypassword and using des security with the plaintext password myprivpass.
  • Associates the SNMPv3 user Admin with a context named newContext.
switch(config)# snmpv3 user Admin auth sha auth-pass plaintext mypassword priv des 
     priv-pass plaintext myprivpass
switch(config)# snmpv3 user Admin context newContext