Configuring SNMP

(The SNMP agent provides read-only access.)
Procedure
  1. Enable SNMP on a VRF using the commandsnmp-server 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 commandsnmp-server agent-port.
  4. By default, the agent uses the community stringpublicto protect access through SNMPv1/v2c. Set a new community string with the commandsnmp-server community.
  5. Configure the trap receivers to which the SNMP agent will send trap notifications with the commandsnmp-server host.
  6. 创建一个SNMPv3上下文并将它与任何available SNMPv3 user to perform context specific v3 MIB polling using the commandsnmpv3 user.
  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 commandsnmpv3 context.
  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 (VRFmgmt).
  • Sets the contact, location, and description for the switch to:JaniceM,Building2,LabSwitch.
  • Sets the community string toLab8899X.
switch(config)#snmp-server vrf mgmtswitch(config)#snmp-server system-contact JaniceMswitch(config)#snmp-server system-location Building2switch(config)#snmp-server system-description LabSwitchswitch(config)#snmp-server community Lab8899X
Example 2

This example creates the following configuration:

  • Creates an SNMPv3 user namedAdminusingshaauthentication with the plaintext passwordmypasswordand usingdessecurity with the plaintext passwordmyprivpass.
  • Associates the SNMPv3 userAdminwith a context namednewContext.
switch(config)#snmpv3 user Admin auth sha auth-pass plaintext mypassword priv des priv-pass plaintext myprivpassswitch(config)#snmpv3 user Admin context newContext