Search

Resume and bio of the author, about this website Couple of articles related to my hobby - robotics
My impressions about immigration to Australia. In Russian only. Recipes for everyday problems solving
Linux-related posts Windows-related posts
Software-related posts A lot of info about hardware
Different tools you might find useful Posts about various web technologies
Everything that doesn't fit the rest of the menu RSS feed for this blog

Tag Cloud

Archives

Links

Andrey Mikhalchuk’s Blog

Technoblog about life

Feb 24, 2008 How to build an inexpensive powerful robot. Reflash your router with new “routerbot” OS

Linksys WRT54GL original operating system was not designed to control external devices, so we need to rewrite it with something more suitable. This post explaines how to do this and provides the new firmware. You may also want to refer to the overall project outline.

I proudly called it “RouterBot OS” in the title, but it is actually OpenWRT Linux with a few mods that make it more suitable for our purposes.

First of all download this file, which is the image of the new OS we’re going to flash. If you’re having problems downloading .bin file (some people reported they are getting .sit file instead of .bin) try zipped version of the image. Of course you have to unzip it before writing the image.

Second, obtain a tftp client for one of your PCs that you will be using for flashing. For linux you can use “atftp” and type (do not run) the following command:
atftp --trace --option "timeout 1" --option "mode octet" --put --local-file openwrt-wrt54g-2.4-squashfs.bin 192.168.1.1

For windows use default “tftp” program. I never used it, but people say the following command should work fine:
tftp -i 192.168.1.1 PUT openwrt-wrt54g-2.4-squashfs.bin

Configure the computer FROM which you will be sending this image (i.e. the one you will be running the tftp command from) to use static IP in 192.168.1.0 network. For instance 192.168.1.10 should work fine.

Connect the computer FROM which you will be flashing to the router’s socket marked as “1″ this is the first socket in the group of 4, closest to the socket that stands alone (the “Internet” port).

Now is the time for flashing. The procedure is the following (learn it by heart as you might have to retry it many times):

  1. Unplug your router from power
  2. Press and hold the reset button (the one next to the Internet port)
  3. Plug your router into power
  4. Run the tftp command on the computer FROM which you’re flashing
  5. Release the reset button

If on the PC screen you see text indicating that something is getting uploaded - that’s a good sign. Wait for another minute - the router should reboot itself.

Now it is time to configure the new OS. From the same machine you flashed your router from telnet to 192.168.1.234. If everything went right you should get the command line prompt (if not - see the troubleshooting later). Immediately run the following commands:

  • uci set wireless.wl0.disabled=0
  • uci commit wireless
  • vi /etc/config/wireless - replace “YourSsidHere” with your wifi network SSID and “YourWepKeyHere” with your WEP key (I’ll add WPA support later after further testing)
  • nvram set boot_wait=on
  • nvram commit
  • passwd - set the root password. After you set new password you will be able not only telnet, but also ssh to your router.
  • reboot

The router should reboot now and in a minute or two you should check your router for the new IP leased to your Routerbot. Alternativery you can modify /etc/config/wireless file and provide static IP to the routebot.

Now about troubles and how to shoot them. The most frequent trouble is if your flashing process didn’t went at all. You ran the tftp command and it just timeouted. In this case you can do nothing else but try again. Try to change the time interval between powering on the router and releasing the reset button. Sometimes it worked for me only when I pressed reset button AFTER I plug the power cord.

Another thing that might happen is that your router may stop responding to any attempts to connect to it using network. In this case take a deep breath and try to reflash it again. If that doesn’t help - use the other 4 wire you exposed from the router’s internals and connect to it using serial port. I’ll provide more details about this process later.

This post is published in Hardware, How To, Linux, Robotics.

44 Responses to “How to build an inexpensive powerful robot. Reflash your router with new “routerbot” OS”

  1. How to build an inexpensive yet powerful robot (How to turn your router into a routerbot) | Andrey Mikhalchuk's Blog Says:

    [...] Comments How to build an inexpensive powerful robot - Reflash your router with new “routerbot” OS | Andre… on How to build an inexpensive yet powerful robot (How to turn your router into a routerbot)How to [...]

  2. Robot barato construido en base a un router Linksys WRT54GL | CyberHades Says:

    [...] Reflash your router with new “routerbot” OS (reflashear el router con el routerbot OS) [...]

  3. Nimit Says:

    Hi,

    If I used the GUI to upgrade Firmware from DD-WRT to Your “RouterBot OS” instead of TFTP, Is that work?

  4. joseph Says:

    should my router be wired to my computer or should this sbe done wirelessly

  5. joseph Says:

    also how do i check my router to find my routerbots IP i know how to get to my router but i am not able to see which ips it leases and to what it leases it to

  6. joseph Says:

    also the operating system is compressed in a .sit file and i do not have stuffit expander and would not like to pay for it are you able to email it unzipped?

  7. Andrey Mikhalchuk Says:

    Joseph,

    I don’t know what’s stuffit expander. The file with the RouterbotOS provided on this page is in .bin format.

    Andrey.

  8. Andrey Mikhalchuk Says:

    Nimit,

    Yes, you can use any gui-based program as soon as it supports tftp protocol.
    If you are asking about using the web gui then I can’t answer positively since I didn’t try this approach myself.
    I would highly recommend using tftp.

    Andrey

  9. Andrey Mikhalchuk Says:

    Joseph,

    - The router should be wired (i.e. you can reflash it using wired interface only as described)
    - After reflash the routerbot’s IP will be 192.168.1.234 (static, it doesn’t use DHCP)

    Good luck!
    Andrey

  10. NimitH Says:

    Andrey,

    Thank you for replied back, I will use the TFTP from WIN XP at the C prompt or may be Linksys TFTP for windows same as I used for flash DD-wrt for linksys for flash your OS, I will receive servo control board with in this week,

  11. Andrey Mikhalchuk Says:

    NimitH,

    Good luck! Let me know if problems and I’ll try to help.

    Andrey

  12. Joseph Says:

    Andrey,
    So i have gotten all of the parts and am trying to install the firmware, i have tried using the basic windows tftp command lin command and tried a couple tftp clients but i have been getting errors. I have gotten a time out error whic you said all i could do was keep trying and i have. I have also gotten a “code pattern is incorrect error” multiple invalid password errors i am using the linksys WRT54GL router and i have done everything that you have said i have also tried changing the password to blank from the managment screen but nothing has worked. Thanks alot and this is a cool project. Good work.

  13. Andrey Mikhalchuk Says:

    Joseph,

    I need a bit more details in order to help you with the problem:
    - Have you successfully reflashed the firmware? If not, please describe your network layout, IP address of the computer you send the image from and the exact error messages you’re getting.
    - At what step you’re getting the “code pattern is incorrect” error? What is the exact model number and hardware revision of your router (available from the sticker underneath the router)?
    - So your console stays black after the router boot. Is that correct? How do you access the console? Do you use the the other serial port available on the motherboard or just telnet/ssh to the device?

    Regards,
    Andrey

  14. Joseph Says:

    Andrey,
    Ok to start i and getting the error while it should be transfering. I am getting three different errors, they all occur at the same time durring the proccess but not during the same tftp command call. I am getting these errors right after i type (tftp -i 192.168.1.1 PUT openwrt-wrt54gs-24-squashfs.bin)(actually it ussually takes about 10 seconds). The errors i am getting are “code pattern is incorrect”, “timeout”, and “invalid password” I am hardwired to the router(bot) so there isnt really a network layout. To answer your first question i have not transfered the firmware that is where i am having problems. my ip address that i am leasing from the router(bot) is 192.168.0.100 but the router(bot) is not connected to a DNS. I have dissablem my wireless because i didnt want to accidentaly flash my wireless router. My router(bot)’s model is WRT54GL v1.1 i do not use the serial intefac because i do not know how to do that. Thanks
    Joseph

  15. Andrey Mikhalchuk Says:

    Joseph,

    The error indicates that the image you’re trying to send to the router is wrong. Please verify the following:
    1. The file you downloaded from this website is correct. The md5 for the file should be ebed9d37eae5180665960145f2e31476
    2. In the network you’re using for reflashing the router there are only two computers (the one you’re running tftp from and the routerbot) connected using a switch or hub. I.e. the computer has static IP (turn off DHCP on that computer and specify all network parameters manually). The network cable from the computer you’re running tftp clint on should go to the switch. The only other device plugged to that switch/hub should be the routerbot. The cable from switch goes to LAN1 port on the router.

    You can flash without switch too if you connect the “flashing computer” and routerbot directly using preferably crossover cable. Using switch and two normal ethernet cables just makes the process a little bit easier in certain configurations.

    Andrey

  16. Joseph Says:

    Andrey,
    By MD5 are you speaking of the hashing algorithm (Message Digest) because i do not know any other MD5 and i was also wondering how i should test to see if that is the correct MD5. I know how to write an md5 hashing algorithm in java but is there an easier way to do it?

  17. Andrey Mikhalchuk Says:

    Joseph,

    Yes, MD5 is the hashing algorithm and you calculate the MD5 sum for a file using md5sum utility in Linux. I believe there are similar utilities for windows.

    Andrey

  18. Joseph Says:

    Andrey,
    I flashed the router bot finally and started to enter the commands that you say but after i changed the ssid and wep it would not let me enter anymore commands so my dad thought it would be a good idea to try and flash it again. So he did it and now nothing works. I cannot ping it at 192.168.1.1 or 192.168.1.234 i cannot telnet to it and it times out whenever i try to tftp to it again. I never succesfully refalshed again so i was wondering if i bricked the router or if there is somthing i can do to fix this problem? when i get on windows it tells me there is limited to not connectivity to the routerbot so i am not sure what is going on. While i continue to yell at my dad i hope that you are able to help me in any way. Thank you

  19. Andrey Mikhalchuk Says:

    Joseph,

    Congratulations! You’re in another very interesting project: unbricking the router :)

    Don’t worry, this is not a difficult task at all. Please follow this link and add serial port interface to the router. Once you have it use your linux experience to debug the router and find what’s the problem. If you can’t debug it please let me know the output from the router.

    Good luck!
    Andrey

  20. Joeseph Says:

    Andrey,
    ok so i didnt brick the router. I just needed to change my computer to a static ip but this is what i was having trouble with at the beggining. First I am not using linux i am using windows, second when i telnet to the routerbot i do actually connect, it opens and shows the router bot os symbol. When i try and change the wirless setting though (ssid)(wep) I get confused. First I access all the settings but how do i save the changes that i make because all i am doing is edditing them in the command window. After i change them it no longer allows me to enter any cammands again either. sorry for all of this hassle but i am just not to familiar with this stuff and am just trying to learn.

  21. Joseph Says:

    Andrey,
    Ok so it turned out that the router was not bricked so i have it working. I am having troubles though with the wireless feature. My house network is set up a little more complicated than just one router conected to the cable mode. We have a Cable modem connected to a DI-604 router. The router is then connected to a hub where all of the computers in my house that are hardwired are connected. On the same hub is a wireless router (Linksys wrt54gs with DD-WRT micro on it) My problem is, I think that the wireless router has the router feature turned off and is just acting as a wireless terminal (I am not sure of this). I am not sure how to connect my routerbot to the wireless. When i look at the log from the DI-604 i notice that it is the one leasing all of the IP addresses to computers throught my house. What router should I put the ssid to. The default gateway on all computers in my house(wireless and hardwires) is the iip address to the DI-604. Thanks for you help and sorry for all of the annoying questions i am just trying to learn about this stuff

  22. Joseph Says:

    Andrey, I am not sure if this is the cause but i am looking at /etc/config/wireless and the current value of option network is lan and when i go to /etc/config/network there is not interface lan do i need to change this? I do not know much about open wrt or linux but i am reading so please help thanks

  23. Andrey Mikhalchuk Says:

    Joseph,

    The routerbot is preconfigured to work as both wired and wireless. For wireless take a look at /etc/config/wireless and change the parameters to match your network configuration. Wired IP address is statically assigned to 192.168.1.234 and the wireless is obtained via DHCP.

    Andrey

  24. Andrey Says:

    ok i didn’t realize that the wireless was configured using DHCP but i have one more question. I am using a windows computer and it does not have a built in ssh and i would rather not have to use a client. I changed the password because you said that it would still allow telnet but then i read on the routerbot that it disables telnet. Is there a way to remove the password and enable telnet again? thanks a lot

  25. Keith Watson Says:

    I tried many combinations to get the router to read and it wouldn’t. I finally stumbled on this combination. In the 4 steps above, add between steps 2 and 3, “Plug your router into power”.

  26. Andrey Mikhalchuk Says:

    Keith,

    Thank you! Correction made.

    Andrey

  27. Andrey Mikhalchuk Says:

    “I am using a windows computer and it does not have a built in ssh”
    I highly do NOT recommend using telnet under almost any circumstances. Let’s make the world safer - use ssh only :) One of the best ssh clients for windows is putty. It’s free. OpenWRT disables telnet somewhere in the startup scripts. You can check them and comment out that line.
    In order to remove the password just use empty password in “passwd” command. Again, highly not recommended.

    Andrey

  28. Keith Watson Says:

    On Windows I found if you do change the password, telnet will report login failed.

  29. Keith Watson Says:

    OK, I just saw the text output at the top of the original login that setting the password disables telnet. :-)

  30. Andrey Mikhalchuk Says:

    Keith,

    This is a security precaution built into openwrt.
    I will disable it in the next firmware release (though I don’t like it and highly recommend using only ssh)

    Andrey

  31. Keith Watson Says:

    Hi Andrey,
    No modifications are needed for that. I just didn’t see all of the instructions in the shell the first time. I cannot seem to find an answer for this… How do I go about transferring files (like my own html files)? I don’t see a tftp or ftp client installed.
    Keith

  32. Keith Watson Says:

    It took some searching but I figured it out myself. :-)

  33. Brad Says:

    everytime I try to down load the file from your site it is a .sit and not a .bin where is the .bin that I need.

  34. Andrey Mikhalchuk Says:

    Brad,

    I provided link to zipped image in the text. Please let me know if problems.
    Wat OS are you using? Do you have Stuffit available on your computer?

    Andrey

  35. Joseph Says:

    Brad,
    I had the same problem for a while, just when saving the document save it as a file type all files and add your own file extention to the name (.bin) and it seemed to work for me

  36. Brad Says:

    Awesome, thank you for the zip, router bot is online. I found it easier to install the software through the firmware upgrade option that the linksys firmware had installed.

  37. Brad Says:

    I was using vista, I dont have stuffit, I think its a vista windows thing.

  38. Andrey Mikhalchuk Says:

    Brad,

    Thank you for letting me know the OS.
    If Joseph is also working under Vista that would be the diagnosis.
    I never tried to download the file from Vista and have no idea how the download would behave under it.

    Andrey

  39. John Says:

    Hi Andrey,
    Excellent project ! I have a problem however, i hope my new router isn’t bricked.I have a wrt54gl ver.1.1. After reading your tutorial and watching some youtube vid, I connected to the linksys setup at 192.168.1.1 through port 1 and went to the “UPGRADE FIRMWARE” tab, where I selected the ‘routerbot OS’that I had downloaded(it was a .bin file) I then pressed “upgrade”. After a few seconds it said upgrade successful. I rebooted the router and can no longer connect. I set my IP as static,192.168.1.1 and also tried 192.168.1.234(I’m a newbie at networking). With the IP set at 192.168.1.234, I can ping that IP. If I try ipconfig, it says media disconnected. I tried telnet, open 192.168.1.234, could not open connection to the host ! I seem to have no connection to the router. Please help !
    thanks,
    John

  40. Andrey Mikhalchuk Says:

    John,

    I think everything will be fine. It’s default behavior of the routerbot OS to disable telnet upon certain circumstances. Try “ssh 192.168.1.234″. You can use “putty” or “securecrt” or any other ssh client.

    I also recommend connecting to the router via switch - in this case you will avoid “media disconnected” error message, otherwise it might take awhile until your computer network interface is up.

    If the computer is still inaccessible please try reflashing it with atftp.

    If nothing helps try this: http://andrey.mikhalchuk.com/2008/10/23/how-to-add-serial-interface-to-wrt54gl-router.html and see if you connect to the router via serial interface.

    Let me know if problems.

    Andrey

  41. John Says:

    Andrey,
    Thanks for the really quick reply ! I did what you said and downloaded putty. I entered 192.168.1.234 in the host name(ssh) and the terminal screen came up saying “login as:”. I tried “admin” and “root” for login names.It then asked me for a password, but won’t let me type anything. First of all, is this login screen generated from the routerbot OS. If so, I guess I’m now connecting.(I hope!) .BTW, I set my static IP as 192.168.1.10, subnet mask as 255.255.255.0 and Default gateway as 192.168.1.234.
    So what next, is there a login/password I need ? Also, I am directly wired to my laptop with no switch, will that be ok?
    Thanks alot,
    John

  42. Andrey Mikhalchuk Says:

    John,

    Direct wiring could confuse some network adapters. When the routerbot on the other end is turned off the adapter on your computer doesn’t see the signal and thinks it is disconnected. When you poweron the routerbot it might take awhile (how long really depends on your adapter/drivers/OS/tuning combination) thus cause some additional confusion. It is just safer to connect via switch, especially during the router reflashing.

    Everything in 192.168.1.* except for 234, 0 and 255 is fine as an IP address for your PC. So it looks like you set up the network correctly here.

    Try “root” as login and “routerbot” as password. “login as:” seems to be standard putty prompt. I can’t help with putty much as I’m using cygwin, not putty. I recommended it only because I know putty is good and it is much simple to install then cygwin. I believe this prompt means that the routerbot is accessible via ssh. Please try “root:routerbot” login:password combination and let me know if that doesn’t work.

    Good luck!

    Andrey

  43. John Says:

    Hi Andrey,

    I ended up returning my ‘defective’ router and getting a new victim :) This time I studied a bit more. I followed your directions, however I used a windows program called TFTP,5. It is super simple and effective. I released the reset button, pressed ‘upgrade firmware’ and away it went. Upgrade successful ! I then opened telnet to 192.168.1.234 and –ROUTERBOT– is alive. Proceeded to start entering the commands you have listed. I am not exactly sure how to enter the following line however:
    vi /etc/config/wireless - replace “YourSsidHere” with your wifi network SSID and “YourWepKeyHere” with your WEP key (I’ll add WPA support later after further testing)
    Can you give an example of this command line with ssid and wep as it needs to be entered.
    Thanks,
    John

  44. Andrey Mikhalchuk Says:

    John,

    Once you change the root password the telnet will get disabled again. So I still recommend ssh as the primary tool to accessing the console.

    in order to change your network settings you need to edit couple configuration files. The best editor to change such files is vi because it available on most linuxes. If you don’t have any vi experience I’d suggest doing search for “man vi” in google - this will return quick manual for vi. So your command will be “vi /etc/config/wireless”, this will open the config file and then you’ll need to use your vi knowledge to modify the file and save it.

    Good luck!
    Andrey.

Leave a Reply

Site Map (c) Andrey Mikhalchuk, 2005-2008