Limiting MIB Access
Problem
You want to limit which MIB variables can be remotely accessed with SNMP.
Solution
You can use the following commands to restrict SNMP access to portions of the MIB tree. This example shows the legacy configuration method:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list
99
permit
Router(config)#
172.25.1.0 0.0.0.255
access-list
99
deny
any
log
Router(config)#snmp-server view
ORAVIEW
mib-2 included
Router(config)#snmp-server view
ORAVIEW
at excluded
Router(config)#snmp-server view
ORAVIEW
cisco included
Router(config)#snmp-server community
ORARO
view
ORAVIEW
ro
Router(config)#
99
snmp-server view
RESTRICTED lsystem.55
included
Router(config)#snmp-server community
ORARW
view
RESTRICTED
rw
Router(config)#
99
end
Router#
Cisco also has a new method for restricting MIB access, which uses the snmp-server group command:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#snmp-server view
ORAVIEW
mib-2 included
Router(config)#snmp-server view
ORAVIEW
at excluded
Router(config)#snmp-server view
ORAVIEW
cisco included
Router(config)#snmp-server group
TEST
v1 read
Router(config)#
ORAVIEW
snmp-server user
ORARO TEST
v1
Router(config)#snmp-server view
RESTRICTED lsystem.55
included
Router(config)#snmp-server group
TEST2
v1 write
Router(config)#
RESTRICTED
snmp-server user
ORARW TEST2
v1
Router(config)#end
Router#
Discussion
By default, enabling SNMP services on ...
Get Cisco IOS Cookbook, 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.