joi, 15 noiembrie 2012

OpenWRT - Serial console recovery on TP-LINK MR 3420

      Romanian short version following - for English version, skip reading the Romanian version :)

***rezumat in limba romana***
Daca ai setat gresit adresele IP ale unui router TP-LINK MR3420 (in cazul de fata), nu mai poti accesa routerul, ca si cum ai ramane incuiat pe dinafara.
Articolul prezinta deblocarea unui router TP-LINK MR3420 care are OpenWRT instalat, folosind conexiunea seriala. Se construieste un cablu USB - serial dintr-un cablu de date gen DKU-5, folosit pentru celulare Nokia, apoi se lipeste / cositoreste un conector pereche pe placa electronica a routerului pentru portul serial al routerului TP-LINK MR3420.
Detalii despre softul utilizat (free si open source), mai jos, in engleza (utilizati Google translate pentru clarificari).
*****

If you like hacking devices, then you may end up on situations when it is mandatory to remove covers in order to get the device up and running again. Of course you will lose warranty, but this is part of the game, right?
Situation: I got a nice TP-LINK MR3420 WiFi router with a USB port. The initial distribution loaded on this router makes possible to use the USB port only to connect a USB 3G dongle to back-up your data connection. Pretty flat, when you can get much more from the USB today.
Fortunately the open source community those days is wide spread and covered even embedded field: OpenWRT is a development community working on firmware for various router models. Similar is DD-Wrt and many others. I used OpenWRT due to the fact that they offered more flexibility on what I want to achieve from that router. And maybe because I found first about them :)
Let's start:
I downloaded and followed the step by step tutorial in order to change my router to OpenWRT. Easy job, you cannot fail.
A ton of options became available, maybe too many. Somehow I wanted to connect that router to my old one and I messed-up my IPs and the result was that I was locked outside. Like when you locked your car's keys inside and you are in the middle of nowhere :)
I did my best to get back the control over the device - negative. No method to recovery, no fail safe, no IP sniffing. So I jumped to the serial console recovery.
Long story short: you need to connect to the router main board a cable and from that cable to command the router to behave the way you want.
First you need the cable: USB to serial (logical levels 3,3V). I bought a cable from DealExtreme.com (DKU-5 type like this) and I modified it in order to be able to connect myself to the router's serial port. Open the USB case to identify the wires: Tx, Rx and GND. Rx must go to serial Tx on the router, Tx must go to serial Rx on the router. Also identify in advance the pins on the router, you need to align build the cable to fit them.

USB cable - new. Cut the end which goes to the cell phone

Use a pull-up resistor of 10k Ohm between Tx and Vcc of the cable. Solder a 4 pins female header 2.54 mm and use some hot glue to stiffen the connection

Solder the USB cage to the PCB, ensure that the wires are also soldered to the PCB

Here is the connection you need to follow in order to have a working cable. Again: make sure that the pins are fitting the connector from the router's PCB

After that step, I soldered a 4 pins header male connector on the main board of the router - instructions can be found on the OpenWRT site. They will fit my cable: Rx on router goes to Tx on cable, Tx on router goes to Rx on cable and GND to GND.

Identify the serial port on the router MR3420 PCB. There you have to solder the 4 pins header.

Soldering the header

Cable connected to the serial port of the router. Make a sign on the connector in order to avoid reverse connecting (this solution is not error proof or poka-yoke)

It was cumbersome to find a driver for the cable, the cable is a classic USB to serial using PL2303 chipset from Prolific (annoying name - I lost time, it wasn't prolific at all). After you find the right drivers for the cable, move to the next step.

After the drivers were installed, Windows will report the PL2303 cable as COM18 (on my situation it was 18, may differ)

Setup the serial connection as indicated in the image

Download PuTTY application and connect to the serial converter using following setup:

Open PuTTY and connect via serial using the mentioned setup. You may save that configuration for future use.

Now you are connected to the OpenWRT router via serial console

After that some strange characters should show on the console, that is good, but the cable is poor. Here I stopped, but I was helped by Sorin - thanks!
write following commands in order to reset to factory defaults:

firstboot && reboot

After that, the router will reboot and you have to use PuTTY again, this time Telnet to connect to the router to 192.168.1.1 . Give following commands to setup root password (write it somewhere in order to have it in case you forget it):

passwd

From this moment on, telnet is not accessible anymore, use PuTTY and SSH or web interface (via Internet browser) to connect to the router, user name is root and password is the one given via telnet and the one you wrote it down. Do you remember it? :)

Hurray! Back in control of your router via web browser interface or SSH

After root login, we can access the multiple options of the router. enjoy

From now on you can start to unleash your router, basically this is a small computer with a Linux distribution and you can connect an USB hub and to that hub you can attach a webcam to have an IP cam, an external USB memory stick, a USB hard disk to share files, you can connect a printer to share it over network and many other things.
Follow-up on this article, soon a webcam will be attached to the router.

Niciun comentariu:

Trimiteți un comentariu