Configuring SNMPv2

SNMPv1 and SNMPv2 use community strings to restrict SNMP access. When you associate it with an SNMP group, you can restrict the access of MIBs for SNMPv1 and SNMPv2c requests.

To configure SNMPv2, perform the following steps.
  1. In privileged EXEC mode, enter global configuration mode.
    device# configure terminal
  2. Add an SNMP view to restrict or allow access to the MIB OIDs.
    device(config)# snmp-server view view2 1.3.6.1 included
    This example adds the SNMP view2 view entry with included permission to allow access for the MIB 1.3.6.1 object ID ('internet').
  3. Add an SNMP group.
    device(config)# snmp-server group admin v2c write view2 notify view2
    
    This example adds the admin group for SNMPv2 and maps the read-write access and notify views to view2.
  4. Add an SNMP community string and associate it with a group.
    device(config)# snmp-server community comm1 group admin
    

    This example adds the comm1 community string and associates it with the admin group to access the MIBs for SNMPv2c requests.

  5. Configure the SNMP trap host associated with community string.
    device(config)# snmp-server host 10.32.147.6 comm1 version 2c severity-level Warning
    

    This example configures 10.32.147.6 as a trap recipient with SNMPv2c on the default target port 162 and associates the comm1 community string.

  6. Enable the traps.
    device(config)# snmp-server enable trap
  7. Access privileged EXEC mode.
    device(config)# exit
    
  8. Verify the configuration.
    device# show running-config snmp-server
    snmp-server contact  "Operator 12345"
    snmp-server enable trap
    snmp-server location  "Building 3 Room 214"
    snmp-server community comm1 group admin
    snmp-server group admin v2c write view2 notify view2
    snmp-server host 10.32.147.6 comm1 version 2c 
     severity-level Warning
    !
    

Example

The following example shows the previous steps to configure SNMPv2.

device# configure terminal
device(config)# snmp-server location "Building 3 Room 214" contact "Operator 12345"
device(config)# snmp-server view view2 1.3.6.1 included
device(config)# snmp-server group admin v2c write view2 notify view2
device(config)# snmp-server community comm1 group admin
device(config)# snmp-server host 10.32.147.6 comm1 version 2c severity-level Warning
device(config)# snmp-server enable trap