Instructables

How to use serial console recovery for OpenWRT

Picture of How to use serial console recovery for OpenWRT
I have a nice wireless router from TP-LINK, MR 3420. It is a typical WiFi router, the reasons I bought it were:
1. it has an USB port and
2. you can load OpenWRT on it.

So I got the device, I installed OpenWRT and somehow I managed to setup the wrong IPs. The result? I was locked outside - it was impossible to get in, typical 192.168.1.1 was not working neither buttons combinations as described in OpenWRT pages (failsafe mechanism is not working or not available for this router).

I asked also someone to try to "unlock" it, but no success. The last solution was to use the serial console recovery.

A few words about serial console recovery for OpenWRT: technically speaking each router has a serial port. This can be either
located on a connector on the PCBA (printed circuit board assembly - the electronic board with components), either are some separate pads on the PCBA and there some wires must be soldered in order to access the serial port.

Also it worth mentioning that the serial port on such devices is not RS232 serial port: serial port on routers is using electrical signals in the range 0V..+3V3 or 0V..+5V, RS232 is using signals -12V..+12V. So using RS232 to USB converters is not useful, we need a 3V3 or 5V logical level to USB converter.

My friend Google told me that there is a cheap way to build such a converter: use a data cable for mobile phones (some old models). Basically you can pay 5$ and get a nice data cable: at one end you have the phone connector, at the other a USB connector with a small PCBA which converts data to USB.

The purpose of this instructable is to describe how to build such cable for a serial console recovery for OpenWRT on TP-LINK MR4320 and  MOST IMPORTANT how to use it because I made the cable, I connected myself, it was working, but I had no clue how to perform the recovery, I am not familiar with Unix / Linux.

Tools needed:
-soldering tools
-screw drivers
-wire cutter
-cutter
-hot glue gun
-helping hands or a small vice


Materials needed
-hot glue
-data cable for mobile phones (type DKU-5 or CA-42)
-2,54mm header 4 pins (both male and female)
-PC with PuTTY

Let's start! 
 
Remove these adsRemove these ads by Signing Up

The network configuration in OpenWrt is stored in /etc/config/network and is divided into interface configurations. Each interface configuration either refers directly to an ethernet/wifi interface (eth0, wl0, ..) or to a bridge containing multiple interfaces. It looks like this:

config interface "lan"
option ifname "eth0"
option proto "static"
option ipaddr "192.168.1.1"
option netmask "255.255.255.0"
option gateway "192.168.1.254"
option dns "192.168.1.254"

You must use : vi command which is an basic editor , so the command is :

#vi /etc/config/network

then you use arrow to go to the desired info you want to change ,press i on keyboard to insert and then modify the IP . After that you press on you keyboard in this order following : "ESC" , ":" , "wq" "Enter"

This way all modification are saved.

Then you issue : #/etc/init.d/network restart and now the OpenWrt router will have the IP you just modify earlier.

Make sens for all that use OpenWrt to read the WIKI from openwrt.org .

There you can find all info including unbrick your router , flashing your router , setup of your router.

CatalinRO (author)  danutleon.zup29 days ago

When I posted this Instructable, 2 years ago, I just begun the OpenWRT trip. Now I realize that Open WRT is quite complicated for a new comer. I think sometimes it is needed punctual information about solving a problem, it took me days to solve such simple topic. WiKi is good if you know what are you looking for and where to look for :) Thanks for your observation!

wow, I can;t believe it was so hard to undo this mistake!
CatalinRO (author)  amandaghassaei2 years ago
Maybe there is another way, I hope, but I didn't find it at that moment - I am not very experienced on this Linux embedded world. Since I struggled a lot, I considered fine to tell to others how to do it to save their time
The thing is that the reset button is not implemented to perform a reset to factory defaults on TP-LINK MR3420, that will be the most convenient way, you will not need to build any cable and your warranty is not broken.