Lab Objective:
The focus of this lab is to understand Embedded Event Manager (EEM) implementation and configuration in Cisco IOS routers. Additional technologies include SNMP security.
Lab Topology:
This lab requires only a single router running, at a minimum, Cisco IOS Software 12.4 Mainline. The router should have at least one Ethernet interface. The primary purpose of this lab is to reinforce configuration knowledge of the stated chapter.
|
IMPORTANT NOTE If you have multiple devices and servers / hosts in your home lab and you would like to test solutions for topics such as Syslog, SNMP and NetFlow by setting up host and viewing charts or logging information, for example, please feel free to do so. While these labs include logging to ‘supposed’ hosts, there are no SNMP or Syslog servers in the http://www.howtonetwork.net racks and so you will not be able to test the solutions in those racks. If you only have a single router, you can bring up the Ethernet interface by implementing the following configuration: ! |
Task 1
Configure the router with a hostname of R1. Next, enable the LAN interface of the router and assign it the IP address 150.1.1.1/24. Ensure that this interface is in an up / up state.
Task 2
Configure an EEM applet on the router such that following any configuration change, the log message ‘SAVING CONFIGURATION’ is printed and the router automatically saves the configuration. The router should also send an SNMP trap to host 150.1.1.254 using an SNMPv2 community string of ‘SECURITY’. This trap should include the message ‘CONFIG SAVED’. Verify your configuration using the appropriate commands.
Task 3
Management is concerned about the device being reloaded accidentally. Until they get an ACS server running TACACS+, which will be used to restrict commands at the user level, they have requested that the ‘reload’ command be ignored when executed on the router. They also request that the shortened form of this command, ‘relo’ is also ignored. Configure an EEM applet to satisfy this request. Ensure that the router prints the message ‘NOT ALLOWED’ whenever this command is attempted. Test and verify your configuration using the appropriate commands.
Task 4
In the future, assume that OSPF will be enabled on the router. To facilitate OSPF adjacency flap troubleshooting, configure an EEM applet that captures the contents of the show processes cpu command to an existing file named PROC_UTIL that is stored in Flash memory. It is important to ensure that this file is not overwritten, but instead, additional data is simply added to it. Next, configure the same applet so that the output of theshow interface serial 0/0 command. This information should be added to an existing file named SERIAL_STATS that is stored in Flash memory. Verify your configuration.
Lab Validation
Task 1
If your routers interface is not connected to a switch or hub, you need to complete this task as is shown below. If you do have a hub or switch, you can omit the loopback and no keepalive commands under the LAN interface. This example assumes a standalone router.
| Router(config)#hostname R1 R1(config)#interface fastethernet 0/0 R1(config-if)#ip address 150.1.1.1 255.255.255.0 R1(config-if)#loopback Loopback is a traffic-affecting operation R1(config-if)#no keepalive R1(config-if)#no shutdown R1(config-if)#exit |
Next, verify your configuration using the show ip interface brief command:
| R1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 150.1.1.1 YES manual up up Serial0/0 unassigned YES unset administratively down down Serial0/1 unassigned YES unset administratively down down |
Task 2
In order to complete this task we need to configure both EEM and SNMP on the router. Ensure that the EEM applet matches the Syslog message ‘%SYS-5-CONFIG_I:’ which indicates that the router has been configured. Next, specify the actions the EEM applet should take. These will include logging a message and sending an SNMP trap which includes the string or data stated in the task. This task is completed as follows:
| R1(config)#event manager applet CONFIGURATION-CHANGE-APPLET R1(config-applet)#event syslog pattern %SYS-5-CONFIG_I: R1(config-applet)#action 1.0 syslog msg “SAVING CONFIGURATION” R1(config-applet)#action 1.1 snmp-trap strdata “CONFIG SAVED” R1(config-applet)#action 1.2 cli command “enable” R1(config-applet)#action 1.3 cli command “write memory” R1(config-applet)#exit R1(config)#snmp-server community SECURITY RO R1(config)#snmp-server host 150.1.1.254 traps SECURITY event-manager R1(config)#snmp-server enable traps event-manager R1(config)#exit |
Next, verify EEM configuration using the show event manager command:
| R1(config)#do show event manager policy registered No. Class Type Event Type Trap Time Registered Name 1 applet user syslog Off Sat Jun 4 07:10:40 2011 CONFIGURATION-CHANGE-APPLET pattern {%SYS-5-CONFIG_I:} action 1.0 syslog msg “SAVING CONFIGURATION” action 1.1 snmp-trap strdata “CONFIG SAVED” action 1.2 cli command “enable” action 1.3 cli command “write memory” |
Following this, verify SNMP configuration using the show snmp command:
| R1(config)#do show snmp Chassis: JAE08020Z7T 0 SNMP packets input 0 Bad SNMP version errors 0 Unknown community name 0 Illegal operation for community name supplied 0 Encoding errors 0 Number of requested variables 0 Number of altered variables 0 Get-request PDUs 0 Get-next PDUs 0 Set-request PDUs 0 Input queue packet drops (Maximum queue size 1000) 0 SNMP packets output 0 Too big errors (Maximum packet size 1500) 0 No such name errors 0 Bad values errors 0 General errors 0 Response PDUs 0 Trap PDUs SNMP logging: enabled |
Next, test your Embedded Event Manager configuration by exiting configuration mode:
| R1(config)#exit R1# *Jun 4 07:24:50.379: %SYS-5-CONFIG_I: Configured from console by console *Jun 4 07:24:50.391: %HA_EM-6-LOG: CONFIGURATION-CHANGE-APPLET: SAVING CONFIGURATION R1# R1# |
Finally, ensure that the router generated and sent an SNMP trap to host 150.1.1.254:
| R1#show snmp Chassis: JAE08020Z7T 0 SNMP packets input 0 Bad SNMP version errors 0 Unknown community name 0 Illegal operation for community name supplied 0 Encoding errors 0 Number of requested variables 0 Number of altered variables 0 Get-request PDUs 0 Get-next PDUs 0 Set-request PDUs 0 Input queue packet drops (Maximum queue size 1000) 2 SNMP packets output 0 Too big errors (Maximum packet size 1500) 0 No such name errors 0 Bad values errors 0 General errors 0 Response PDUs 2 Trap PDUs SNMP logging: enabled |
Task 3
In order to complete this task, you need to configure EEM to skip the specified commands when they are issued on the router. This task is completed as follows:
| R1(config)#event manager applet NO-RELOAD R1(config-applet)#event cli pattern “relo*” sync no skip yes R1(config-applet)#action 1.0 syslog msg “NOT ALLOWED” R1(config-applet)#exit |
Next, verify your EEM applet using the show event manager command:
| R1#show event manager policy registered No. Class Type Event Type Trap Time Registered Name 1 applet user syslog Off Sat Jun 4 07:10:40 2011 CONFIGURATION-CHANGE-APPLET pattern {%SYS-5-CONFIG_I:} action 1.0 syslog msg “SAVING CONFIGURATION” action 1.1 snmp-trap strdata “CONFIG SAVED” action 1.2 cli command “enable” action 1.3 cli command “write memory” 2 applet user cli Off Sat Jun 4 07:32:20 2011 NO-RELOAD |
Finally, test your configuration by attempting to reboot the router from the console using either the reload or relo commands. If you have completed this successfully, neither one will work:
| R1#reload R1# *Jun 4 07:36:54.031: %HA_EM-6-LOG: NO-RELOAD: NOT ALLOWED R1# R1# |
Task 4
The requirements of this task are straightforward. To include the output of a command to an existing file, you need to use output redirection, specifically, the append keyword:
| R1(config)#event manager applet OSPF R1(config-applet)#event syslog pattern “Neighbor Down: Dead timer expired” R1(config-applet)#action 1.0 cli command “enable” R1(config-applet)#$cli command “show processes cpu | append flash:PROC_UTIL” R1(config-applet)#$d “show interfaces serial 0/0 | append flash:SERIAL_STATS” R1(config-applet)#exit |
Next, verify your EEM applet using the show event manager command:
| R1#show event manager policy registered No. Class Type Event Type Trap Time Registered Name 1 applet user syslog Off Sat Jun 4 07:10:40 2011 CONFIGURATION-CHANGE-APPLET pattern {%SYS-5-CONFIG_I:} action 1.0 syslog msg “SAVING CONFIGURATION” action 1.1 snmp-trap strdata “CONFIG SAVED” action 1.2 cli command “enable” action 1.3 cli command “write memory” 2 applet user cli Off Sat Jun 4 07:32:20 2011 NO-RELOAD 3 applet user syslog Off Sat Jun 4 07:41:21 2011 OSPF |
If you have more than one router, you can test the applet by enabling OSPF and then shutting down an interface so that the neighbor adjacency goes down.
Final Router Configurations
R1
|
R1#term len 0 Current configuration : 1528 bytes R1# |