Remote Flashing a WRT54GL

Discussion in 'Tomato Firmware' started by ng12345, Jul 1, 2009.

  1. ng12345

    ng12345 LI Guru Member

    What is the best way to flash a tomato upgrade to a linksys router remotely?

    I have done it before, by remote logging in to a computer behind the linksys, flashing the firmware, and reconnecting to the remote computer after the flash is successful.

    Obviously there is a risk in that the flash may not be successful, but that is an acceptable risk to me.

    However, I can not clear the nvram settings (which many people here recommend after an update), since once I clear the settings, i can no longer remote connect to the computer.

    Does anyone have a solution to this (aside from asking somebody to assist on-site)? Obviously not all the settings have to be restored, in my case the only settings that would need to be restored to get a working system:

    1. set router's dhcp server subnet
    2. set router wan to static ip

    Could this be accomplished through a script on the remote computer?
  2. The Doctor

    The Doctor LI Guru Member

    I can't actually answer your entire question, but I can tell you this much. From what I have read, plus my own personal experience, you do not need to erase the nvram when you are upgrading from one unofficial build of tomatoes to another. If you are using a tomato mod, or are upgrading from a different firmware such as the original Linksys or perhaps DD-WRT then doing a complete erase is highly recommended.

    I assume you're either using Windows remote desktop or a program like TightVNC, but that doesn't really matter. Your problems remain the same. How difficult is it for you to get direct access to the computer? How computer smart are the folks where it is located? The easiest solution is to go there yourself, or talk somebody else through it.

    Okay, here's the first question I should have asked. Do you really need to upgrade at all? I often like to run the latest version of the firmware myself, but one of my sisters is still running version 1.09 because I don't want to risk an upgrade failure (I can't get there, and she's not good at computers). So, my first suggestion is don't upgrade at all unless you absolutely need to.

    There is, I believe, one way to get it accomplished providing that the flash does not fail. That would be to compile your own version of tomato from the source code, and change all the defaults do what you need. Then when you do the race, it will automatically be set to the required parameters. I'm fairly sure this can be done, but I don't have a clue about how to accomplish it, as I have never compiled or modified any source code.

    Another possibility is perhaps adding a script to the router which will execute on boot up, apply all the correct settings, then erase itself, then restart the router. I have no idea if this may be possible, nor any clue of how to do it.

    There are some fairly smart folks on here, I wouldn't be surprised if somebody comes up with a decent solution for you, but I think the best solution is to not upgrade if you don't have to.

    Good luck
  3. bogderpirat

    bogderpirat Network Guru Member

    i believe there are telnet applications that will let you execute bash scripts on a remote computer - or at least i've heard that the unix rsh tool offers this capability.

    what you would have to do, once you find a tool that does this, is the following:

    log onto the router and find out about the required nvram variables that will give you a required basic functionality. you might succeed in doing that by copying both the results of "nvram show" BEFORE and AFTER making an NVRAM clear into a file and doing a diff - then isolate the essential changes required for internet connectivity (wan_*, dhcp stuff, maybe static dhcp entries and port forwards, so the remote tool to the computer behind the router works) and write a script for this aforementioned application that re-inputs the variables after the router is reset, like so:
    nvram set <variable1>="<value1>"
    nvram set <variable2>="<value2>"
    nvram commit
    then what you'd do is probably just create a .cmd file containing the launch parameters of your telnet tool, something like
    ipconfig /release
    ipconfig /renew
    telnet --script=nvramvars.txt <host> <login/pw>
    wait 60
    ipconfig /release
    ipconfig /renew
    or something and then create a task on the computer behind the router to execute that batch file like 2 minutes after you start resetting your router.

    it will then renew the ip address via dhcp to be on the standard subnet and revert your essential settings back to the point where you can access the router, then have the router reboot and have the computer behind the router get a new dhcp ip address again.

    as was previously mentioned, this is a pretty unsafe thing to do though, but i'm guessing if you're not willing to team up with someone at the remote site, it can't be too important to you :)
  4. ng12345

    ng12345 LI Guru Member

    I guess this is mostly a thought experiment and I appreciate your replies.

    You are right, it is possible to walk someone through the process, but if I could even simplify it to asking them to double click on the script; that would be much better, and in my mind actually much "safer" or at least more reliable than me walking them through the steps over the phone. Additionally, the step of going from manned click to automated process, in my mind would be a pretty simple one.

    I was thinking along the lines of a script, and the idea of using a telnet script sound pretty close to meeting the parameters of this task.

    With regard to a "need to upgrade," you are right, I do not "need" to. I have full functionality of the routers in their current form (4 routers running various versions of tomato with openvpn; 1 with roadkill's 1.19, 2 with sgtpepper's 1.21 vpn mod, and 1 with sgtpepper's 1.23 vpn mod). My main goal, if possible, is to upgrade the one with roadkill to the tomato with openvpn gui mod. But it is also the router that can not tolerate any downtime, and is pretty geographically isolated from me.

    Thanks for your thoughts. When I have some free time I'll play around with a telnet script since it sounds like a good way to go (again simply to re-establish connectivity to the remote computer).
  5. baldrickturnip

    baldrickturnip LI Guru Member

    I do this via VNC to a laptop which has a usb mobile data modem connected to it. I rely on a person on site to take the laptop to the location and connect it to the internet , I can then see its dyndns updater update then connect - I used to get them to plug in the LAN but it can be done via wifi.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice