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.
The first part of the setup is to enable SSH on DD-WRT.
- Log in to your router.
- Navigate to Services –> Services
- Enable SSHd under the Secure Shell section.
- Ensure that Password Login is enabled.
- Navigate to Administrator –> Management
- Enable SSH Management and ensure SSH Remote Port is set to 22.
- 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
- Now that you have SSH enabled on your device you must download Plink.exe from here.
- 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
- Open your text editor (Notepad).
- 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.
- 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.
- Example batch file:
C:\Example\Location\plink.exe -ssh 192.168.1.1 -l Administrator -pw Password1 “reboot”
ping 192.168.1.1 -t
- Save your file with a “.bat” extension.
Your batch file to reboot your dd-wrt should now work. If you have any questions or comments please feel free to reply below!
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.