Remotely reboot DD-WRT routers

Reboot DD-WRT

With my network monitoring powershell script I have noticed that the DD-WRT routers that a client uses will become unresponsive. Because of this I wanted an easy way for my client to reboot DD-WRT wireless routers without having to get physical access to the routers, especially since some of them aren’t easily accessible. There are two types of problems that happen with these wireless routers. The first problem is that they become completely unresponsive and fail the ping check that is done with my powershell script. In this case the router likely requires a physical reboot in order to function again. There is not much that can be done otherwise. The second problem that happens, as seems to happen with any wireless router, is that the wireless will randomly stop working. One way I have set up to reduce this problem is to have the routers reboot daily in the middle of the night. Despite this, the wireless will occasionally stop working throughout the day. This problem can be fixed by sending a reboot command to the router through a wired connection. This type of problem and the solution may be ideal for home users that have their desktop wired to their DD-WRT but have many wireless devices or like my situation where I want clients to be able to easily reboot wireless routers without my intervention. Once you have this set up you can double click a file to reboot your wireless as opposed to doing a physical reboot. That is what we will look at here.

Setup

The first part of the setup is to enable SSH on DD-WRT.

  1. Log in to your router.
  2. Navigate to Services –> Services
  3. Enable SSHd under the Secure Shell section.
  4. Ensure that Password Login is enabled.
  5. Navigate to Administrator –> Management
  6. Enable SSH Management and ensure SSH Remote Port is set to 22.
  7. If you skip steps 2 through 4 then it will not be possible to enable SSH Management in the Administration section.

Download and prepare Plink

  1. Now that you have SSH enabled on your device you must download Plink.exe from here.
  2. Place the “plink.exe” file somewhere that is accessible by everyone that may use your DD-WRT batch file reboot program. For my application it is done in an office setting so I placed the file in a share location that is accessible by everyone.

Create your batch file

  1. Open your text editor (Notepad).
  2. The command looks as follows:

PLINK-PATH -ssh ###.###.###.### -l USERNAME -pw PASSWORD “reboot”

Where PLINK-PATH is the location of “plink.exe”, example C:\DD-WRT\plink.exe.

###.###.###.### is the local address of the dd-wrt router you wish to reboot. It may look something like 192.168.1.1.

USERNAME and PASSWORD are the username and password of your dd-wrt router.

  1. For my batch file I also added a second line so that the person rebooting the router can get visual confirmation that the router is rebooting. That line is the following:

Ping ###.###.###.### -t

This line will bring up a command prompt window that will continuously ping your router. It will start with lines beginning with “Reply from ###.###.###.###…” to show the router responding prior to reboot. Once the reboot command executes on the router it will show “Request timed out” as the router reboots itself. Lastly you should see “Reply from ###.###.###.###…” after the router is back online.

  1. Example batch file:

C:\Example\Location\plink.exe -ssh 192.168.1.1 -l Administrator -pw Password1 “reboot”
ping 192.168.1.1 -t

  1. Save your file with a “.bat” extension.
Execute Reboot DD-WRT Batch File

Execute Reboot DD-WRT Batch File

Your batch file to reboot your dd-wrt should now work. If you have any questions or comments please feel free to reply below!

Example Setup

This is how I have it set up for my office client so that the wireless routers can be easily rebooted as needed and provides warnings to not reboot particular wireless routers unless they are sure that they aren’t being used.

Reboot DD-WRT - Example Folder

Reboot DD-WRT – Example Folder

 

Remotely reboot DD-WRT routers was last modified: October 20th, 2016 by Mike Page
Posted in DD-WRT, Free, IT Management, Network Monitoring.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.