Things you cannot do with Tclsh
What would you think if you’d receive three queries about the same (somewhat obscure) feature within six hours? It started with a nice e-mail from an engineer that I’ve corresponded with in the past. He wanted to send a Wake-on-LAN packet to a PC in a remote office. Usually you could use the ip directed-broadcast feature, but he wanted to use the remote office router to generate the packet.
A few hours later an engineer from another country that had sent me a few interesting configuration tips a while ago sent an almost identical question:
Since you're a whizz in tcl on IOS, how about a few lines of code to implement sending wake-on-lan magic packets from an IOS router !
To top it off, the following line came not long afterwards from an almost-anonymous source:
Hi Ivan, I have read several articles on your tcl-ios very interesting, I'm learning to use the IOS. Could you say if there is any way to generate a magic packet on ios to boot pc by Wake on LAN? Would be a good entry for your page.
I don't believe in coincidences, so I'm guessing these three engineers were trying to solve very similar problems ... and I keep wondering what happened in their networks in the last week.
Unfortunately, I was not able to help them. The Wake-on-LAN packet has to be sent to the broadcast address and it has to contain pretty long payload, so it's usually sent as a UDP packet (ICMP echo packet would also be an option). Core Tcl supports only socket API and thus does not support UDP (or any other protocol on top of IP but TCP). While various Tcl implementations support UDP with help of external libraries, you cannot use the same libraries in Cisco IOS. So it looks like there's no mechanism to generate a UDP packet with desired payload from Cisco IOS. Am I missing something?
Oh, and there's yet another option: if you can afford to invest $3500 per site, you can install AXP in your router to send the Wake-on-LAN packets.
is it possible to use EEM/IPSLA to create a probe with one or more UDP packets and defining the content of the packets (multiple MAC address to wake up, I believe) with bcast destination address? We wouldn't use TCL, but EEM can be configured remotely via SNMP...
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=2427