Logging Unauthorized SNMP Attempts
Problem
You want to log unauthorized SNMP attempts.
Solution
Use the following commands to configure your router to log unauthorized SNMP requests:
Router#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list99permitRouter(config)#172.25.1.0 0.0.0.255access-list99permithostRouter(config)#10.1.1.1access-list99denyanylogRouter(config)#snmp-server communityORAROroRouter(config)#99snmp-server communityORARWrwRouter(config)#99endRouter#
Discussion
If you are concerned about unauthorized access to SNMP services on your router, it can be quite useful to configure the router to maintain detailed records of every failed request. These verbose log messages can provide information on incorrectly configured management servers as well as malicious (or just plain nosy) users.
Simply adding the keyword log to the deny any line in your access-list instructs the router to log all unauthorized SNMP attempts.
The following command will display the status of your SNMP access-list:
Router#show access-listStandard IP access list 99 permit 10.1.1.1 (1293 matches) permit 172.25.1.0, wildcard bits 0.0.0.255 (630 matches) deny any99log(17 matches) Router#
Unlike the example shown in Recipe 17.6, the show access-list output now includes the log keyword on the deny any line. The router will now send information on every unauthorized SNMP request to the logging facility (see Chapter 18 for more information ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access