5

Is there a way to shutdown an interface on a Cisco router based on time periods? I would like to shut the cellular interface when it is not necessary.

Can this be done with the event manager and action in combination of time-based access-list or track?

6

You can do this with time-based ACL's when talking about ports, or with EEM when talking about interfaces:

interface wlan0
ip address 10.1.1.1 255.255.255.0 
ip access-group 101 in      

access-list 101 permit tcp 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255        
eq telnet time-range EVERYOTHERDAY  

time-range EVERYOTHERDAY 
periodic Monday Wednesday Friday 8:00 to 17:00

Source: http://www.cisco.com/en/US/products/sw/secursw/ps1018/products_tech_note09186a00800a5b9a.shtml#timebasedtimerange

When you want to shut down an interface, take a look at the next article:

https://supportforums.cisco.com/thread/202630 (answer Joseph Clarke)

event manager applet shutdown_port
event timer cron cron-entry "0 0 * * *"
action 010 cli command "enable"
action 020 cli command "config t"
action 030 cli command "interface FastEthernet1/0/1"
action 040 cli command "shut"
action 050 cli command "end"
action 060 syslog msg "Interface FastEthernet1/0/1 has been shutdown"

event manager applet noshut_port
event timer cron cron-entry "0 8 * * *"
action 010 cli command "enable"
action 020 cli command "config t"
action 030 cli command "interface FastEthernet1/0/1"
action 040 cli command "no shut"
action 050 cli command "end"
action 060 syslog msg "Interface FastEthernet1/0/1 has been restored"

in the example above: The port will be shutdown every day at midnight, and brought back up every day at 8 am.

You should look into the cron-entry option (like crontabs in linux/unix) reference: http://www.rogerperkin.co.uk/ccie/index.php/eem-2/understanding-cisco-eem-event-timer-cron/

There are 5 values you can specify for the cron timer

  • minute – this controls what minute of the hour the command will fire values between 0 and 59
  • hour – this controls what hour the command will run – specified in the 24 hour clock format 0-23 0=midnight
  • dom – day of month that you want the command to run e.g 20th = 20
  • dow – day of week it can be numeric 0-7 or name of day e.g sat

Examples:

01 * * * * This command is run at one min past every hour
17 8 * * * This command is run daily at 8:17 am
*/1 **** this command runs every minute
  • this can work but what about when the interface is in bridge mode? – smignon Oct 4 '13 at 8:56
  • I've added the solution for shutting down interfaces via EEM (Embedded Event Manager) :) – Bulki Oct 4 '13 at 9:00
  • 1
    bulki, your solution works but FYI... a 1.0, 2.0 EEM numbering scheme breaks when you reach event 10.0. It's better to number as 010, 020, etc... – Mike Pennington Oct 4 '13 at 9:37
  • Oh ok, thx for the tip Mike :) Smignon, I've noticed the EEM needs to use a user as well to be able to go in to enable mode. this can be done by: event manager session cli username <existing-username> – Bulki Oct 4 '13 at 9:41
  • 1
    @Mike, Ok, that explains indeed. The router I've tested it on was configured with tacacs. – Bulki Oct 4 '13 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.