The tutorial presented below is a small excerpt from the “System Management” section of beta IEWB-RS Vol I version 5.

SNMPv3 protocol a security model, defining new concepts to replace the old community-based pseudo-authentication and provide communication privacy by means of encryption. The new concepts are: user, group and security level. A group defines the access policy for a set of users. An access policy defines which SNMP objects can be accessed for reading and writing or which SNMP objects can generate notifications to the members of a group. Policy is defined by associating the respective read, write or notify view with a group. By using a notify view, a group determines the list of notifications its users can receive. A group also defines the security model and security level for its users.

Essentially, all groups form a table, which maps users to their read/write/notify views and security models. Note that if a group is defined without a read view than all objects are available to read. Contrary to that, if no write or notify view is defined, no write access is granted and no objects can send notifications to members of the group. The notify view is usually not configured manually. Rather, it’s added by the snmp-server host command automatically, when a users in a group is bound to a notification target host. Note that SNMP will use the username configured with snmp-server host along with the security model specified to authenticate and possibly encrypt the notifications. If the security model is set to «noauth» then a plain username is sent in a manner resembling the old community string.

The following security models exist: SNMPv1, SNMPv2, SNMPv3. The following security levels exits: “noAuthNoPriv” (no authentiation and no encryption – noauth keyword in CLI), “AuthNoPriv” (messages are authenticated but not encrypted – auth keyword in CLI), “AuthPriv” (messages are authenticated and encrypted – priv keyword in CLI). SNMPv1 and SNMPv2 models only support the “noAuthNoPriv” model since they use plain community string to match the incoming packets. The SNMPv3 implementations could be configured to use either of the models on per-group basis (in case if “noAuthNoPriv” is configured, username serves as a replacement for community string). All users sharing a group utilize the same security model, however, the specific model settings (password, encryption key) are sep per-user. Note that SNMPv3 does not send passwords in clear-text and uses hash-based authentication with either MD5 or SHA1 functions (HMAC authentication – the packet conted is hashed along with authentication key to produce the authentication string). For encryption, statically configured keys are used along with DES56 symmetric cipher (that mean the same key should be configured on NMS for the particular user).

Consider the example below. Three groups are created. Groups «NORMAL» and «RESTRICTED» are used to control remote users access and group «TRAP» is used to send notifications. Note that only read-view is specified for group “RESTRICTED” and it’s limited to IfEntry fields for a fixed interface index. The group «RESTRICTED» has an access-list applied to control the NMS stations the users can access from. Note that the groups have different security levels. Next, three users are created, one for each group respectively, with their authentication and encryption keys. Finally, SNMP link up and down notifications are enabled and SNMP trap destination host is configured. This operation automatically creates and assigns the «notify» view for the respective group (will appear in show commands output below).

! Access-List to control users in the RESTRICTED group.
access-list 99 permit

! Set ifIndexes persistent, for view definition is based on IfIndexes
snmp-server ifindex persist 

! The first view covers the “ISO” sub-branch and the second one covers
! all “lifEntry” fields for interface with IfIndex 3 (Serial 0/0).
snmp-server view NORMAL iso included
snmp-server view RESTRICTED ifEntry.*.3 included

! Define three groups. The first one allows to read and write
! into a large portion of the MIB tree. The second one allows reading
! just information specific to Serial 0/0 interface, and limits user
! access based on access-list
! The third group is for sending traps. A user belonging to this group
! will be utilized to send trap messages. Its name and password
! will be used to create authentication credentials in a trap message
! and the users privacy password will be used to encrypt the packet.
! Note that this group has NO notify view defined, which is done on
! on purpose. The notify view will be automatically populated when
! notification hosts are configured and bound to users

snmp-server group NORMAL v3 priv read NORMAL write NORMAL
snmp-server group RESTRICTED v3 auth read RESTRICTED access 99
snmp-server group TRAP v3 priv

! Users, their passwords and encryption keys are defined now
snmp-server user NORMAL NORMAL v3 auth sha CISCO priv des56 CISCO
snmp-server user RESTRICTED RESTRICTED v3 auth sha CISCO
snmp-server user TRAP TRAP v3 auth sha CISCO priv des56 CISCO

! Allow sending traps and configure a destination host. Note that when
! a host is configured and bound to SNMPv3 username, the corresponding
! group notify view is populated based on traps allowed for this
! particular destination. This is why it’s not required to configure
! the notify view for a group.
snmp-server enable traps snmp linkup linkdown
snmp-server host traps version 3 priv TRAP

Perform some basic verifications next using the show commands. Note that SNMPv3 users do not appear in the running configuration for security reason (different management channel) but you can see some information using show snmp users command. Also, pay attention to the automatic view assigned to the “TRAP” group.

Rack1R6#show snmp user 

User name: TRAP
Engine ID: 80000009030000119221DA80
storage-type: nonvolatile	 active
Authentication Protocol: SHA
Privacy Protocol: DES
Group-name: TRAP

User name: NORMAL
Engine ID: 80000009030000119221DA80
storage-type: nonvolatile	 active
Authentication Protocol: SHA
Privacy Protocol: DES
Group-name: NORMAL

Engine ID: 80000009030000119221DA80
storage-type: nonvolatile	 active
Authentication Protocol: SHA
Privacy Protocol: None
Group-name: RESTRICTED

Rack1R6#show snmp group
groupname: ILMI                             security model:v1
readview : *ilmi                            writeview: *ilmi
row status: active

groupname: ILMI                             security model:v2c
readview : *ilmi                            writeview: *ilmi
row status: active

groupname: TRAP                             security model:v3 noauth
readview :           writeview: 
row status: active

groupname: TRAP                             security model:v3 priv
readview : v1default                        writeview: 
row status: active

groupname: NORMAL                           security model:v3 priv
readview : NORMAL                           writeview: NORMAL
row status: active

groupname: RESTRICTED                       security model:v3 auth
readview : RESTRICTED                       writeview: 
row status: active	access-list: 99

Rack1R6#show snmp view
*ilmi system - included permanent active
*ilmi atmForumUni - included permanent active
NORMAL iso - included nonvolatile active
v1default iso - included permanent active
v1default internet.6.3.15 - excluded permanent active
v1default internet.6.3.16 - excluded permanent active
v1default internet.6.3.18 - excluded permanent active
v1default ciscoMgmt.394 - excluded permanent active
v1default ciscoMgmt.395 - excluded permanent active
v1default ciscoMgmt.399 - excluded permanent active
v1default ciscoMgmt.400 - excluded permanent active
RESTRICTED ifEntry.0.3 FF:EF included nonvolatile active
*tv.FFFFFFFF.FFFFFFFF.FFFFFFFF0F iso.2.840.10036 - included volatile active
*tv.FFFFFFFF.FFFFFFFF.FFFFFFFF0F internet - included volatile active
About Petr Lapukhov, 4xCCIE/CCDE:

Petr Lapukhov's career in IT begain in 1988 with a focus on computer programming, and progressed into networking with his first exposure to Novell NetWare in 1991. Initially involved with Kazan State University's campus network support and UNIX system administration, he went through the path of becoming a networking consultant, taking part in many network deployment projects. Petr currently has over 12 years of experience working in the Cisco networking field, and is the only person in the world to have obtained four CCIEs in under two years, passing each on his first attempt. Petr is an exceptional case in that he has been working with all of the technologies covered in his four CCIE tracks (R&S, Security, SP, and Voice) on a daily basis for many years. When not actively teaching classes, developing self-paced products, studying for the CCDE Practical & the CCIE Storage Lab Exam, and completing his PhD in Applied Mathematics.

Find all posts by Petr Lapukhov, 4xCCIE/CCDE | Visit Website

You can leave a response, or trackback from your own site.

9 Responses to “SNMPv3 Tutorial”

  1. Karsten says:

    A very good introduction. But you should mention, that newer IOS-Versions also support a stronger encryption than the old DES.

  2. Frans Indo says:

    Dear Petr and friends,

    I am a little bit confusing.

    1. Why we must use snmp-server ifindex persist? Must we use this command
    when SNMP v3 is required to use?

    2. About snmp-server view RESTRICTED ifEntry.*.3 included, how to determine
    that S0/0 has an index of 3 instead of 1 or 2. Let’s say there are 3 interfaces
    such as f0/0, s0/0, g0/0. How to know the index of each interface?

    Thanks and looking forward to your kindly advice.


  3. dan says:

    1. snmp-server ifindex persist is not a part of SNMPv3. That is IOS enhancement for ifIndex persistence.

    2. It depends on ifIndex assignment. ifIndex and interface name (ifName) can be found in ifTable.
    If the ifIndex persistence is enabled, I guess there exists a text file to show the mapping between ifIndex and ifName or ifDesc.

  4. sovanvichet says:

    Dear all

    “About snmp-server view RESTRICTED ifEntry.*.3 included, how to determine
    that S0/0 has an index of 3 instead of 1 or 2. Let’s say there are 3 interfaces
    such as f0/0, s0/0, g0/0. How to know the index of each interface?”

    show snmp mib if if detail
    will told you what the index of the interface

  5. Alex says:

    Thanks a lot for this post. It was very helpful for me. I read a lot of docs but I didn’t understand ow to configure SNMPv3. Here I found all that I need to accomplish my task.

  6. Skye Greif says:

    Exceptional tutorial! It saved me a hell of a lot of time. Honestly, thank you.

  7. Hussain Mortuza says:

    Hi Petr,

    Reading your article is an awesome , very educational and brainstorming experience for me. I admire your tutorials. My sincere gratitude and my thankfulness to you. Looking forward to read more.


  8. Sultan says:

    Thanks for this very helpful article.
    I’ve one question, if I want to include Cisco CDP MIB only, do I need to include ISO also?

  9. epetrov says:

    My questions is about snmpv3 at all, not for specific vendors.
    Is it possible to assign snmp v3 user with AuthPriv security model to group which model is AuthNoPriv? And then use AuthNoPriv level for getting data.
    And if “yes”, is it possible to get response from agent with AuthPriv model enabled. I mean is it possible to get encrypted data for user in this case?
    For example:
    snmp-agent group v3 MONGRP authentication read-view MONVIEW
    snmp-agent usm-user v3 MONUSR MONGRP authentication-mode sha “pass” privacy-mode aes128 “pass”
    In this document as in many others I found phrase “users sharing a group utilize the same security model”. Or phrase like this ” if the group security level is not the same as the user security level, the error shown is … “


Leave a Reply


CCIE Bloggers