====== Reflashing via Failsafe mode and without USB ====== ===== Using Python and Linux ===== If your device is messed up and you are not able to change the network-configuration useful, you may reflash the router, using you local network and a temporary webserver. In the following HowTo, I assume that you are using an MR3020, but this method works for all routers: you have only to exchange the image(-link). I assume you have a Linux-Computer with a working Python installation. 1. Connect your laptop to the internet. 2. Choose the correct image-file while referring to [[openwrt:hardware|our hardware list]], then open a Terminal and run: cd /tmp wget http://stable.openwrt.piratebox.de/auto/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin 3. After you have downloaded the image, run the following command to launch a small basic webserver: **Python 2.7**: python -m SimpleHTTPServer 8000 When this fails (you maybe have **Python 3.x**): python3 -m http.server 4. Then connect to your MR3020 and boot it into failsafe mode 5. Set your computer to the static IP 192.168.1.2 6. From Terminal, type: telnet 192.168.1.1 7. Run the following command to download the image onto your MR3020: cd /tmp wget http://192.168.1.2:8000/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin 8. If this worked, flash the image (the exact MTD-command may differ on other hardware) and initiate an immediate reboot if everything was fine (-r) mtd -r write openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin firmware Then you have a fresh install. Sometimes something went wrong on the router. Sometimes, I call it: "a bit is switched wrong", the flash does not work on the first time.. especially if you have a corrupt system. You can recognize that, when your OpenWRT doesn't store your changes- then simply reflash like above. Hope this helps. ===== Reflash in Failsafe-Mode using Netcat ===== Your box gets messed up? Sometimes it is only possible to recover it during failsafe mode. But how can you put the firmware image file to your box? I read about something called Netcat. The detailed [[http://techtinkering.com/2013/03/25/using-netcat-to-create-ad-hoc-links-between-applications-and-machines/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+TechTinkering+%28TechTinkering%29|HowTo]] does not fit well, because the most images lack the server support. After some test, I found out that you can turn it around. This method works if your computer is Linux. If you don't have Linux as OS, try a live version of it, i.e. [[http://grml.org|grml]]. To transfer a file to your router (The following assumes that you already have access via failsafe-mode): **On the computer** check what you IP is (command: ifconfig). Then we are starting a Server and pipe the image file into it. After it is done, it will generate a hash-value. # cat openwrt....bin | nc -l 3333 && md5sum openwrt....bin (sometimes (on my Gentoo-box it was) the command is) # cat openwrt....bin | nc -l -p 3333 -X && md5sum openwrt....bin **On the router** we connect to the Server (on the Router can the filename be shorter, different): # cd /tmp # nc 192.168.1.x 3333 > openwrt....bin # md5sum openwrt....bin Compare the hash value of both outputs, if they are equal then proceed with flashing.