Name

snmp-server view — global

Synopsis

snmp-server view view-name oid-tree {excluded | included}
no snmp-server view

Configures

An SNMP view

Default

None

Description

This command defines an SNMP view that can be used in the snmp-server community command. A view is a list of SNMP object trees. By default, the entire SNMP object tree is available for access. A view restricts access to some subset of the entire tree. Different views can be made available to different SNMP communities.

view view-name

A unique name that identifies this SNMP view.

oid-tree

An SNMP object ID (in either numeric or human-readable form). All nodes underneath the given object belong to the tree. Asterisks can be used as wildcards when specifying the object ID.

excluded or included

Specifies whether the given oid-tree is included in or excluded from the view.

Example

Say that you want to give some group SNMP access to the ifEntry table for interface 2. (Perhaps this group is connected to the router through interface 2. Note that the interface number here is an index into the SNMP interface table, not an IOS interface name.)

To achieve this, define a view:

snmp-server view subset2 ifEntry.*.2 included

Then set the community string for this view:

snmp-server community sub2in view subset2 RO

Now users can use the community string sub2in to access the ifEntry table for interface 2, but aren’t allowed to access other SNMP objects.

Get Cisco IOS in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.