Unbricking your router with a Raspberry Pi en

By Gtoniser on Sunday 24 February 2013 15:15 - Comments (6)
Category: Raspberri Pi, Views: 4.126

So one of my friends wanted to install a new firmware on his router (a Netgear WNR3500Lv2). Unfortunately he downloaded a wrong version and thus his router refused to boot. Bricked.

Now there are some tutorials on the internet on how to unbrick this router, one involves a USB-TTL cable and one uses a method which short circuits 2 pins on the mainboard.
The second method helped me out when I bricked my router, the Netgear WNR3500Lv1 (note the v1), but the v2 has a different chip layout and we could not find the right chip on his model.

The first method seems a bit less dangerous, but requires a USB-TTL cable, which I don't happen to have. What I do have is a Raspberry Pi, which has a serial port connection.

Getting started

- Raspberry Pi running Raspbian
- Some cables
- Broken WNR3500Lv2

I'm connecting to my RPi via SSH.
To be able to use the serial port we first need to disable the console login that the RPi automatically starts up on the serial port when booting.

This is done by commenting out the following line in /etc/inittab
change
code:
1
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
to:
code:
1
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100


Now after rebooting the RPi, we can use the serial port for our own purposes.

Connecting the RPi to the router

The Raspberry Pi serial ports are on GPIO 14 and 15:
http://lavalink.com/wp-content/uploads/2012/04/raspberry-pi-serial_sm-241x300.jpg(source: lavalink.com)

We connect these ports to the RX and TX on the router (make sure the router is turned off!). We also connect the GND.
http://static.trabot.net/external/tweakers/rpi-serial-router-01_thumb.jpg(click)
From left to right: GND, RX, TX

Overview:
http://static.trabot.net/external/tweakers/rpi-serial-router-02_thumb.jpg(click)

I am using a breadboard here in between, you can ignore this and all the wires on it, the only reason I used it is because I didn't have any Female-Female cables. Connecting the RPi directly to the router is how it works.

Restoring the firmware

Now to get the serial interface working we use minicom. Install it first on the RPi with
code:
1
sudo apt-get install minicom

Then run minicom on the serial port of the RPi
code:
1
sudo minicom -b 115200 -o -D /dev/ttyAMA0

We are now connected directly to the router with our Raspberry Pi. Feeling like a hacker already?

Now power on the router while holding Ctrl + C in the terminal window:
http://static.trabot.net/external/tweakers/rpi-terminal.png

When this is done just execute the command
code:
1
tftpd
to start the tftp deamon.

Now what I did was connecting a laptop to the router with a static IP address (since I was using my main PC to control the Pi) so that we can reach the router on 192.168.1.1.
When this is done we can download the original firmware for the WNR3500Lv2 and push this to the router with tftp
code:
1
tftp -i 192.168.1.1 put FIRMWARE_FILE

After this the router rebooted and I could access the admin interface on 192.168.1.1 in my browser.

If you want to try this for yourself, the following guides can be helpful:
SSH connection to your RPi
Using the RPi serial port
http://www.myopenrouter.c...USB-TTL-Cable-on-Windows/ (step 9 and further explain how to put the firmware on the router)
http://www.myopenrouter.c...-A-Serial-Cable-on-Linux/ (explains how to use this method on linux, you could use this to push the firmware from your RPi)

Volgende: Android en je privacy 03-'13 Android en je privacy
Volgende: De vuurwerkbom 12-'12 De vuurwerkbom

Comments



By Tweakers user Nazaiaow, Sunday 24 February 2013 15:38

You forgot to mention how awesome it looked to see the output of the router while it booted! :D
Glad my router works again :)

By Tweakers user wartos, Sunday 24 February 2013 20:20

Waarom heb je hier een RPi voor gebruikt? Ik bedoel, een gewone PC met een usb-serial adapter werkt evengoed...

By Tweakers user Gtoniser, Sunday 24 February 2013 20:22

wartos wrote on Sunday 24 February 2013 @ 20:20:
Waarom heb je hier een RPi voor gebruikt? Ik bedoel, een gewone PC met een usb-serial adapter werkt evengoed...
Omdat ik (zie 3e alinea) niet zo'n kabel heb :)

By Tweakers user ik.ben.iemand., Monday 25 February 2013 00:05

Ik had van mijn ISP een redelijk brakke router gekregen (oeps, ze stuurde 'm dubbel :P), alleen toen ik zoiets als dit wilde gaan doen werd mijn vader een beetje boos dat ik de router (er zit een soort van garantie op) open had geschroefd.


En toen was ik redelijk teleurgesteld dat het dus niet mocht :P

By Tweakers user Joshu, Saturday 23 March 2013 12:20

Dit is geniaal, ik was al een tijdje op zoek naar een manier om dit te doen zonder zo'n usb kabel. Eindelijk wordt deze router weer eens goed gebruikt.

Bedankt!

Comments are closed