snmp-server context

Maps the context name in an SNMPv3 packet protocol data unit (PDU) to the name of a VPN routing and forwarding (VRF) instance.

Syntax

snmp-server context context_name [ vrf-name vrf_name ]
no snmp-server context context_name [ vrf-name vrf_name ]

Command Default

None

Parameters

context_name
Specifies the context name that is passed in the SNMP PDU.
vrf-name vrf_name
Specifies the VRF instance that can be retrieved when an SNMP request is sent with the context name.

Modes

Global configuration mode

Usage Guidelines

Use the no form of the command to delete the SNMP server context.

For SNMPv1 and SNMPv2, you must map the context with the community string. The SNMP agent supports 256 contexts to support context-to-VRF mapping.

For SNMPv3, you only need to map the context with the VRF. The SNMPv3 request PDU itself provisions for the context. Only one context is allowed for each VRF instance.

Important

Important

SNMP SET requests work only on the default VRF.

Examples

The following example configures an SNMP server context to a VRF for SNMPv1 or SNMPv2.

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

The following example configures an SNMP server context to a VRF for SNMPv3.

device# configure terminal
device(config)# snmp-server context mycontext1 vrf myvrf1