Reconnect scripts are used to make your router reconnect automatically. Purpose: Get a new dynamic IP to continue downloading through platforms like Rapidshare, Uploaded.to, etc. without the need for a paid premium account. For some routers there are even plugins for Firefox, which allow a 1-click reconnect.
However, I’m using Linux and would prefer a bash script to reconnect my router, which can be automatically triggered if needed. My router is a Linksys WRT54GL, which is known to be capable running third party firmwares. I decided to use the Tomato firmware, as I had some problems with DD-WRT. Unfortunately a reconnect script for Tomato version 1.28 is hard to find and if I found one, it didn’t work. Why?
A reconnect script for Tomato looks like this:
curl “http://name:passwort@router-ip/service.cgi” -d “_service=wan-stop&_redirect=status-overview.asp&_sleep=2&_http_id=TIDf7f7ba5565192d1e”
curl “http://name:passwort@router-ip/service.cgi” -d “_service=wan-restart&_redirect=status-overview.asp&_sleep=5&_http_id=TIDf7f7ba5565192d1e”
Obviously you need to fill your own data: username, password and router-ip. Unfortunately that’s not all. The developers of the Tomato firmware have introduced the http_id as a security parameter to avoid cross-site scripting attacts. Thus, the http_id must be the right one for your router to make the script above work. I guess that the http_id depends on some unique value (e.g. network mac) of your router and thus should be mostly individual. Therefore you need to find out you http_id on your own. To do so, simply log into your router via SSH and execute:
nvram show | grep http_id
That would return your individual http_id:
Tada! Enter this http_id into the script shown above (in both curl commands!) and your script is ready to go (and works!). As the http_id is stored in the NVRAM, it can be changed at some time. However, if you don’t reset or re-flash your router it should stay the same. Otherwise: You now know how to obtain your http_id.
This method should work for earlier versions of Tomato, too. Please respect copyrights if you are downloading files.