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
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
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:
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.
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.
Yes a tcl script maybe but i don't know how. i didn't find any example ...
anyway thanks Walter
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).
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 :)
Here's some pointers for kron:
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.
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.
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?:-).
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:
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.
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?
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.