Configuring an SNMP server context to a VRF

A single SNMP agent can support multiple instances of the same MIB module by mapping the context name to a virtual routing and forwarding (VRF) instance created within the device. The SNMP context name is used to identify the VRF and fetch the MIB details of the mapped VRF from the underlying modules.

To configure an SNMP server context to a VRF for SNMPv1 or SNMPv2, perform the following steps.
Note

Note

For SNMPv3, use the snmp-server context command only. The SNMPv3 request PDU itself has the provision for the context name as input.
Important

Important

SNMP SET requests work only on the default VRF.
  1. In privileged EXEC mode, enter global configuration mode.
    device# configure terminal
  2. Map the context with the community.
    device(config)# snmp-server community public groupname admin
  3. Create a context and map it with a VRF.
    device(config)# snmp-server context mycontext vrf myvrf
  4. Map the community to the context.
    device(config)# snmp-server mib community-map public context mycontext
  5. Verify the configuration.
    device# show running-config snmp-server
    ...
    snmp-server community public groupname admin
    snmp-server context mycontext vrf myvrf
    ...
    snmp-server mib community-map public context mycontext

Example

The following example shows the previous steps for the configuration.

device# configure terminal
device(config)# snmp-server community public groupname admin
device(config)# snmp-server context mycontext vrf myvrf
device(config)# snmp-server mib community-map public context mycontext