Automatically Reboot Your Tomato / DD-WRT Based Router

We’ve all been through this song and dance before. Unplug the modem, unplug your router – wait for a minute and plug them back in. After a few years of this routine – I finally decided to do something to remedy this little inconvenience. Previously I covered how you can craft a batch file to reboot your modem, but what about your router?? Fortunately if you own a router that is capable of running Tomato or DD-wrt  – you can easily reboot your router alongside your modem whenever your PC detects that the internet is down!


First things first, If you don’t know if your router is capable of running one of the above alternative firmware options listed above – You will want to check to see if you have a compatible router.

If you have one of the above routers, It is a fairly easy process to flash your routers firmware and upgrade. There is plenty of documentation on how to proceed with the upgrade, so make sure to read through the specific instructions for your model of router. If you perform the upgrade in haste, you could end up bricking your router!


1.) Once you have Tomato / DD-wrt installed, you will need to login to your routers web interface @

2.) You will then need to enable SSH.
(In Tomato this setting needs to be enabled in 2 places)

3.) Once SSH is enabled, download and run Putty to test your SSH connection to your router and accept the certificate!

PuttyCert(The router log in credentials will be the same that you use to log in to the web interface )

Once you are logged in to your router via Putty, now is the perfect time to test our reboot command! With the routers web interface open in the background, go ahead and enter the following command and verify that the router begins the reboot process.

You will need to download Plink in order to send the SSH reboot command.


5.) Once you have a working reboot command, You just have to create a batch file that can test for internet connection and reboot your devices when they go down. The one listed below does the following:

  1. Pings 3 sites – If it fails to connect proceeds to do the following
  2. Disable + Re-enable Local Area Connection
  3. Reboot Modem
  4. Reboot Router
Feel free to modify/change the above script per your needs. If you do copy my code, all I ask is that you give credit to the original author(me) and link back to this post.


6.) Lastly, while having this sweet batch file is all fine and well – We need to automate running this script to make this truly useful to us. You can do this by simply creating a Task in Windows Task scheduler to run every 10 minutes or so. Just make sure to run the script using the Windows “System” account.
(This will make sure it runs hidden!)


If you are interested in a more detailed break down of how to go about resetting your Modem, or crafting the batch file to run via Task scheduler – Check out my previous post covering How to Reboot your Cable Modem.



  1. Korben Dallas