1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tomato and Linksys : Can we make a IP Power cycling switch

Discussion in 'Tomato Firmware' started by Aquafire, Jul 5, 2010.

  1. Aquafire

    Aquafire LI Guru Member


    I am running Tomato Firmware v1.27.8747 ND USB vpn3.6 on Linksys WRTSL54GS running in PPoE mode, connected to a bridged DSL Modem. Been pretty happy and satisfied with its performance and options.

    Recently I came across the article :


    I was just wondering that can we somehow add this functionality to tomato.

    Of course it would involve doing some amount of hardware modification work to it, and making the power controlling baord/circuit , however i still am willing to spare my Linksys WRTSL54GS router for it.

    Anyways..was just an idea, since there are commercial products available for the same purpose , but all of them are somewhat over priced.
  2. but2002

    but2002 Networkin' Nut Member

    You could easily make a script that would flash the SES light when there's no internet connection, and use that as a trigger to do exactly that.
  3. Aquafire

    Aquafire LI Guru Member

    Sounds good,

    Please help a newbie like me.

    Can you post some example commands and where do we have to write them in the tomato interface.

    How to program the commands to flash the SES light.

    The rest of the electrical circuit including the transistor and diode I will get made by my cousin who is an electronics engineer.

    I think it would be a really useful addition to the tomato community at large if some knowledgeable expert can finish this as a DIY project.

    Thanks for your guidance.
  4. Lost Dog

    Lost Dog LI Guru Member

    This sounds like a good idea... My ISP changes my IP address about once a month. Whenever that happens I lose connection and my network stays down until a power cycle. Normally this isn't an issue but it's happened twice now when I was out of the country (once in China and once in Japan).

    I use hopto.org to access my network and when I'm traveling I tunnel all my on the road browsing through ssh on the router. When this goes down I'm hosed! It was totally needed in China to bypass the Great Firewall.
  5. Engineer

    Engineer Network Guru Member

  6. Aquafire

    Aquafire LI Guru Member

    Well the scripts mentioned at


    is for rebooting the Linksys router unit itself.

    Where as we are talking about the idea of power-cycling the DSL modem attached to the WAN port of linksys.

    The idea given by but2002 sounds good, however we need to help of a guru about how to send signal to the SES flash light to blink when the ping response breaks down by using the GPIO on linksys WRTSL54GS. This power burst can then be used by having a transistor and relay attached to the power circuit to go in an Off/On state, hence the DSL adapter connected to the power switch will cold-boot the modem (which is getting out of sync for me quite frequently).

    So I badly need some expert advice and guidance for it. It sound like a good DIY project and would be greatly useful for everyone. Maybe gurus like SGTPepperSKU and Teddy_bear would listen to us :).
  7. Engineer

    Engineer Network Guru Member

    Sorry, I thought you had to reboot the router, not the modem. My apologies...
  8. Lost Dog

    Lost Dog LI Guru Member

    Oh wait.... I guess I misunderstood as well. I need the router rebooted not the modem.
  9. ripat

    ripat LI Guru Member

    Strange that you have to reboot your router. The pppoecd daemon should notice the connection interruption and request a new IP to your ISP. What are your WAN settings? Did you try the keepalive mode? And if you did, don't put the Check Interval too low as this could cause the login process to hang. I have put 60 seconds and have no problem at all. My ISP has a policy of 24h ip lease and my IP gets reset once a day.

    Found this googling around, not tomato related but well Linksys related:
  10. Aquafire

    Aquafire LI Guru Member


    Accessing a software reboot option whether in the modem or router would work correctly in a perfect world. As long as router/modem is responsive , then it would respond to such requests.

    The kind of power-cycling (hard or cold boot) situation is one where the modem and/or router actually HANGS and accepts and hence processes no command via the web interface. The only solution to get the access and sync back is to manually turn off and on the modem again. (happens virtually zilch with the router).

    Thats the actual article link in my first post is pointing towards, and I guess its a pretty handy solution

    Especially when like another commenter on this thread, I am also on foreign trips and the only vital link b/w me and my data is the home DSL modem (which if hangs, should get auto power cycled) by such solution.

    There are commercial boxes available in the market for the purpose, like this one:


    however being a tomato fan I am just wondering, considering the pretty excellent work done by the community, this shoul'nt require too much of time and effort and a DIY can be made for all of us.
  11. ripat

    ripat LI Guru Member

    So, I guess that you already have a Keep Alive type of pppoe session but it fails to renew its IP for any reason.

    You could easily write a little script that pings (or wegt) a remote site and if no reply received within a reasonable time, do a software reboot.

    Pseudo code:

    if ! ping google.com;then
    Script to be executed on your router by cron every hour for example.
  12. ripat

    ripat LI Guru Member

    double post sorry.
  13. Aquafire

    Aquafire LI Guru Member

    I guess you are referring to the router reboot itself. This is not the intended purpose of this thread. Please read through the start in detail. I am trying to power cycle the DSL modem based on this script.

    I am almost done with making the switch board with transistor and relay.

    Can anyone who is an expert in it write me a script and how to paste it in the tomato interface to control the power source

    The script should perform the following as (cron job or scheduled job i dont know what is it called in linux) :

    1. Ping any IP address or domain name ex : www.google.com every 3 minutes

    2. Ping response wait time should be whatever is the optimum.

    3. If ping back not received within a specifed 'x' amount of time.

    4. Then check the status of

    5. Be default it should be enabled / ON ( i guess so), means the connected DSL modem switchboard relay is ON.

    6. If GPIO it is ON, then send a signal to disable/off it for 1 minute and then send a signal to enable it again.

    7. Hopefully the connected modem sync within one minute with the ISP, so the cron job would start receiving the ping reply back again.

    8. I think on every router restart/cold-boot the GPIO PIN should be in enabled state. (just to reset , if in case a power break down occurs during the one minute delay time between powering off and powering on the connected circuit again).

    Maybe i am flawed, honestly I am not a router or linux expert, so I have explained in simple words.

    The gurus and experts can improvise on that to make a soild and stable script to perform the intended operation.

    Thanks for help.
  14. Aquafire

    Aquafire LI Guru Member

    Almost done with the electrical circuit to be placed in the modem power adapter and will be controlled be a light activated resistance.

    Upon detecting an internet disconnection the router will turn on and off thew white (SES) light for a defined period of time and will in turn power reset the modem power for an interval of 5 seconds.

    Will post results soon if possible.
  15. ehunt123

    ehunt123 Networkin' Nut Member

    Few options here:

    basic rule of options scale with price.

    cheapest I ever did was using a X10A 232 module on a router to powercycle a modem via X10. It was unreliable, cheap but also cost $30 and I could use it elsewhere.

    Second thing I've used are 1U units I got off eBay for $100. They had 4xserial and 4xpower (telnet only) but retail was $1k. Very nice since it had snmp and some network options.

    Best are >$500 and up, easily. Getting a 1u unit that can "do it all" from power cycling to console can easily 10x this.
  16. RonWessels

    RonWessels Network Guru Member

    I trust you are performing the switching on the low-voltage side of the power adapter rather than the mains side? Otherwise you really want to use something with CSA/UL approval, like this.

Share This Page