cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2670
Views
20
Helpful
6
Replies

Timed port shut no shut help

Neil spur
Level 1
Level 1

Hi, I have a Poe switch that I need to configure to shut a port at a specific time and enable it the next day. Was looking at timed ACL but I understand this only denies protocols and not the port. Just started to read about eem. Is this the way forward ? I have searched for anything similar I can use and I’m out of my depth especially the tcl Side of things.

Any advice appreciated.

 

3 Accepted Solutions

Accepted Solutions

Hello,

 

I think the 2960X does not fully support EEM. You should be able to do this with TCL and Kron. I'll test and get back with you...

View solution in original post

Hello,

 

here are two scripts that should work. The first one will shut interface GigabitEthernet0/0 at 17:00 each day, the second one will unshut it at 08:00 each day. Change the interface number and the time to what applies to you. Also, my device uses 'flash0', yours might just be named 'flash'...

 

2960X#tclsh
puts [open "flash0:shutdown_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "shut" "end"
}
tclquit
config t
kron policy-list policy_shutdown_interface
cli tclsh flash:shutdown_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_shutdown_interface at 17:00 recurring
policy-list policy_shutdown_interface
!
exit
exit
wr mem

 

2960X#tclsh
puts [open "flash0:unshut_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "no shut" "end"
}
tclquit
config t
kron policy-list policy_unshut_interface
cli tclsh flash:unshut_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_unshut_interface at 08:00 recurring
policy-list policy_unshut_interface
!
exit
exit
wr mem

View solution in original post

6 Replies 6

Hi

You can use EEM script.

 

 This is not new here in the forum. Take a look here:

 

https://community.cisco.com/t5/network-management/eem-script-shutdown-interface-at-a-certain-time/td-p/4504788 

Neil spur
Level 1
Level 1

Thank you for your time.

Neil spur
Level 1
Level 1

Slight update as the link sent me to a script for a diiferent system. I have a cisco WS-C2960X-24PS-L running c2960x-universalk9-mz.152-2.E6 ios.

In conf t i don't have the event command.

Hello,

 

I think the 2960X does not fully support EEM. You should be able to do this with TCL and Kron. I'll test and get back with you...

Hello,

 

here are two scripts that should work. The first one will shut interface GigabitEthernet0/0 at 17:00 each day, the second one will unshut it at 08:00 each day. Change the interface number and the time to what applies to you. Also, my device uses 'flash0', yours might just be named 'flash'...

 

2960X#tclsh
puts [open "flash0:shutdown_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "shut" "end"
}
tclquit
config t
kron policy-list policy_shutdown_interface
cli tclsh flash:shutdown_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_shutdown_interface at 17:00 recurring
policy-list policy_shutdown_interface
!
exit
exit
wr mem

 

2960X#tclsh
puts [open "flash0:unshut_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "no shut" "end"
}
tclquit
config t
kron policy-list policy_unshut_interface
cli tclsh flash:unshut_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_unshut_interface at 08:00 recurring
policy-list policy_unshut_interface
!
exit
exit
wr mem

Neil spur
Level 1
Level 1

You sir are a magician…

hats off to the people who can come up with this stuff. I thought doing a ccna was tough.

Awesome work fella,