Configuring SNMP
Procedure
-
Enable the SNMP agent on either the management interface, or the switch data ports, with the command
snmp-server vrf
. For example, use the commandsnmp-server vrf mgmt
to enable SNMP on the management interface. Use the commandsnmp-server vrf default
to enable SNMP on thedefault
vrf which is initially assigned to all data ports. -
Set the system contact, location, and description for the switch with the commands
snmp-server system-contact
,snmp-server system-description
, andsnmp-server system-location
. -
If required, change the default SNMP port on which the agent listens for requests with the command
snmp-server agent-port
. -
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
. -
Configure the trap receivers to which the SNMP agent will send trap notifications with the command
snmp-server host
. -
To support SNMP v3 users, define one or more SNMPv3 contexts with the command
snmpv3 context
, then define credentials for one or more users with the commandsnmpv3 user
. Finally, associate defined users with an SNMPv3 context with the commandsnmpv3 user context
. -
Review your SNMP configuration settings with the commands
show snmp agent-port
,show snmp community
,show snmp system
,show snmpv3 context
,show snmp trap
,show snmp vrf
, andshow snmpv3 users
.
Example
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