schedule an action on a router

Hello everyone,

has anybody an idea how can i schedule an interface on a router to be shut down, after a specific period of time or periodically?

thanks in advance

Reply to
vsakel
Loading thread data ...

Do you need it to be shut down (i.e., drop carrier, remove the connected routes from the routing tables, stop sending BDPUs, etc.), or do you need it to stop permitting traffic through? Also, should the time it goes down be relative to whenever it was put up (e.g., "stay up for 30 minutes and then shut yourself down"), or should it be absolute times (e.g., "stay up from 02:30 to 03:00") ?

If what you need is to stop passing traffic, then you can use time- based access lists, available since about 12.0T:

formatting link
time-based access-lists are, if I recall correctly, not available with all switches, and may require some kind of Enhanced Image on other switches. They are supported on a fairly wide variety of routers, but I do not know if they are supported on -all- Cisco routers; you could check the feature navigator
formatting link

Reply to
Walter Roberson

I want ''physicaly'' to be shut down (a serial interface) in order the other end's router to realise this as a line disconnection. Actually it is a complex X25 reroute implementation which must be happened every day at night.

formatting link

Reply to
vsakel

Perhaps a tcl script? And/or something using kron ? I haven't investigated either, so I don't know their limitations or what IOS versions support them.

Reply to
Walter Roberson

Yes a tcl script maybe but i don't know how. i didn't find any example ...

anyway thanks Walter

Reply to
vsakel

Basic one - try a mains power timer on the DSU or whatever drives the serial line (if its powered separately). No bits will move if the link is dead....

or if the link uses a routing protocol, maybe you can use Walters idea and block the routing packets?

(i have a vague memory that sometimes routing packets go around filtering, so you need to test this on your box / IOS version).

formatting link
>

Also dont forget you will need the router clock to be accurate - NTP?

And pick a box with battery backed clock - otherwise things will go crazy for a while after a power cut :)

Reply to
stephen

Here's some pointers for kron:

formatting link
formatting link
kron allows the scheculing of cli EXEC level commands. "tclsh" is an EXEC level command so possibly you could trigger the start of a tcl script. tcl can be used to submit configuration mode commands such as selecting an interface and "shutdown" it.

formatting link

This is probably a hack approach to someone who knows what they are doing with this stuff ;-) But it isn't clear that there is a meaningful event loop in tcl itself unless you happen to have the Embedded System Monitor module installed.

Reply to
Walter Roberson

Maybe you could use a script in conjunction with snmpset? Something like : snmpset interfaces.ifTable.ifEntry.ifAdminStatus. i 2

make sure proper security is in place for snmp write.

Reply to
Uto cen

I like the snmp one all controlled externally.

Regarding Cisco tcl examples, where were you looking, under the bed? Did you try google?

[cisco tcl example] in google returns what looks to me like some excellent examples as the first hit and the second and third look rather promising.

There are also tools for remotely controlling routers (and anything else that you can telnet to) via the command line. Expect, Perl Expect extensions. Terraterm, kiwi tools, Cisco Open Source Initiative on Sourceforge.

I think that you need a least the Enterprise feature set to get TCL and Cron (Kron? or is that Korn?:-).

Reply to
Bod43

None of the first couple of pages of google hits even hints at how a timed event might be executed. It appears that a couple of Cisco (or ex-Cisco) employees have written books about using tcl, but the ones I find were written a decade ago and thus do not describe what is possible for IOS.

Here's a source that -maybe- would help:

formatting link

Reply to
Walter Roberson

of google hits even hints at

The missing piece was that I assumed that the timing and the operations carried out were seperate functions. I have not tried it but I have heard that Enterpries IOS supports "cron" which provides in some way the scheduling leaving tcl for the operations.

Maybe I am mistaken.

I had a look at the first example that google returned and it looked as if there was enough to get going with.

If there really is a cron lookalike and a seperate tcl then I would certainly use them in that way and would not consider rolling my own scheduller in tcl, even if the tools were provided. But then I am not really a programmer.

Reply to
Bod43

I already posted pointers to Cisco's kron facility. I might have missed something, but it appears that kron is restricted to EXEC mode commands. Invoking the tcl shell is an EXEC mode command, but does not look to take arguments (such as a single command or a script name). As I do not happen to have anything close to an appropriate device on hand, I cannot experiment to see what can be hacked together.

I like the external SNMP Set idea, but I am wondering if the administrative status of an interface is settable via SNMP ? If not, then the SNMP used might have to be to set the name of a configuration file and then to trigger a tftp of that configuration file, with the configuration file having the appropriate "shutdown" or "no shut" command.

Possibly there is an approach in the "cli cns" kron command.

Oh wait -- is copying in a file from tftp an EXEC mode command or a config mode command?

Reply to
Walter Roberson

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.