Infrastructure Services · Topic 2 of 6

Troubleshooting SNMP v2c and v3

Troubleshoot SNMP on IOS XE: v2c community strings against v3 users, groups and security levels, plus traps, informs, ACLs and verification commands.

  • 4 min
In a nutshell
  • SNMP uses UDP 161 for requests and UDP 162 for traps and informs.
  • v2c uses community strings in clear text.
  • v3 adds users, authentication and encryption.

What it is

SNMP lets a management station read data from a device, change settings, and receive alerts when something happens.

The device runs an agent, and the management station is the NMS. Data is organised in a MIB, where each item has an object identifier (OID).

SNMP version 2c secures access with a community string. Version 3 adds users, authentication and encryption.

NMSmanagerGET or SET on UDP 161Agentrouter MIBtrap or inform on UDP 162NMSmanager

How it works

The agent answers requests on UDP port 161, and sends alerts to the NMS on UDP port 162.

Message types

MessageDirectionPurpose
Get and GetNextNMS to agentRead one or more objects
GetBulkNMS to agentRead many objects in one request, in v2c and v3
SetNMS to agentChange a value
TrapAgent to NMSAlert with no acknowledgement
InformAgent to NMSAlert that the NMS must acknowledge

An inform is retransmitted if no acknowledgement arrives. A trap is sent once.

SNMPv2c

Version 2c uses a community string as a shared password. The string is sent in clear text. A read only community allows reads, and a read write community allows changes.

R1(config)# snmp-server community READONLY1 RO 10
R1(config)# snmp-server community READWRITE1 RW 10
R1(config)# access-list 10 permit 10.1.1.50
R1(config)# snmp-server host 10.1.1.50 version 2c READONLY1
R1(config)# snmp-server enable traps
R1(config)# snmp-server source-interface traps Loopback0

The number 10 ties the community to an ACL, so only that station may use it. The snmp-server host line sends traps to the NMS, and snmp-server enable traps selects which events send them.

SNMPv3

Version 3 has three parts.

  • A view limits which parts of the MIB are visible.
  • A group sets the security level and the views.
  • A user belongs to a group and has its own keys.

There are three security levels.

LevelAuthenticationEncryption
noAuthNoPrivUsername onlyNo
authNoPrivYesNo
authPrivYesYes
R1(config)# snmp-server group ADMINS v3 priv access 10
R1(config)# snmp-server user SNMPUSER ADMINS v3 auth sha AuthPass123 priv aes 128 PrivPass123
R1(config)# snmp-server host 10.1.1.50 version 3 priv SNMPUSER

The group is set to priv, which means authentication and encryption. The user must have both an auth and a priv key to match.

The NMS must use the same user name, level and keys. A mismatch of any one of them makes requests fail.

Troubleshooting

The first question is whether the request reaches the agent, and the second is whether the credentials match.

  • Is UDP 161 reachable, and is no ACL or firewall in the way?
  • Does the community or user match exactly, including case?
  • Does the ACL on the community include the NMS address?
  • For v3, do the security level, auth protocol and keys all match?
  • For traps, is snmp-server host set and are the traps enabled?
  • Does the source address match what the NMS expects?
R1# show snmp
R1# show snmp community
R1# show snmp user
R1# show snmp group
R1# show snmp host
R1# debug snmp packets

show snmp shows packet counters, including counters for rejected requests. show snmp user lists the v3 users. A v3 user is not shown in the running configuration, so use this command instead.

NMSSNMPv3 requestwrong auth keyAgentauthentication failscounter risesshow snmpbad authentication

Traps do not arrive for several reasons. The host might be wrong, the event may not be enabled, or the router source address is not trusted by the NMS. An inform helps because the router knows when the NMS did not acknowledge.

Exam tip

The NMS and the agent must agree on the version first. A v2c request to a v3 only user will fail, whatever the credentials.

What to remember for the exam

Seven facts cover most questions on this topic.

  • SNMP uses UDP 161 for requests and UDP 162 for traps and informs.
  • v2c uses community strings in clear text.
  • v3 adds users, authentication and encryption.
  • v3 levels are noAuthNoPriv, authNoPriv and authPriv.
  • An inform is acknowledged, and a trap is not.
  • An ACL on a community limits which stations may use it.
  • show snmp user shows v3 users, which are not in the running configuration.
Watch out

A read write community with a guessable name lets an attacker change the device. Use an ACL and prefer v3.

Common mistakes

These five mistakes appear often.

Wrong community or case. Community strings are case sensitive.

ACL without the NMS. The agent silently ignores the request.

Security level mismatch. A user configured for authPriv fails if the NMS asks for authNoPriv.

Traps not enabled. snmp-server host alone does not choose which events are sent.

Different keys. Auth or privacy keys that differ from the NMS cause authentication errors.

Check yourself

Work through these three questions.

  • Which ports does SNMP use?

    UDP 161 for requests to the agent and UDP 162 for traps and informs to the manager.

  • What is the difference between a trap and an inform?

    An inform must be acknowledged by the NMS and is resent if it is not, while a trap is sent once with no acknowledgement.

  • Which security level gives both authentication and encryption?

    authPriv.

Topic 2 of 6 in Infrastructure Services

Test yourself on Infrastructure Services

The full Cisco CCNP 300-410 ENARSI question bank has 857 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.