Time-based wireless interface activity

From CT3

Jump to: navigation, search

This solution uses timer cron EEM events to disable an interface (wireless interface in the sample code) during a fixed period of time (from 10PM to 7AM in the sample code).

Two simple EEM applets are defined to execute the disable and enable commands at predefined times (triggered with the timer cron events). A third applet using a timer countdown event is used to ensure the interface is enabled ten seconds after the router reload in case the disabled interface state was saved in the startup configuration.

Usage guidelines

  • Change the timer cron specifications in the EnableInterface and DisableInterface applets.
  • Copy the EEM applets into the router's configuration.
  • Set the _disable_ifname EEM environment variable to the interface name with the event manager environment configuration command.

Author

Ivan Pepelnjak, © 2008 NIL Data Communications

Source code

event manager environment _disable_ifname dot11radio0
!
event manager applet DisableInterface
 event timer cron name DisableInterface cron-entry "0 22 * * *"
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "shutdown"
!
event manager applet EnableInterface
 event timer cron name EnableInterface cron-entry "0 7 * * *"
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "no shutdown"
!
event manager applet EnableAfterReload
 event timer countdown name EnableAfterReload time 10
 action 1.0 cli command "enable"
 action 1.1 cli command "configure terminal"
 action 1.5 cli command "interface $_disable_ifname"
 action 1.6 cli command "no shutdown"
Personal tools

CT3

Main menu