Google

2014-06-04

DD-WRT OpenWRT Bricking Router and springing it back to life

These are my notes from bricking my router and bringing it back!

How it all began? 
I have a love-and-hate relation with DD-WRT. I have been on and off for the last 5 years. After recent revelations of backdoors on routers and modem, I decided to go back to it.

DD-WRT
Upgrading from stock firmware to DD-WRT is documented well enough.
I never bothered with 30/30/30 cycles when upgrading. Simply used firmware upgrade page and pointed it to the DD-WRT image.

OpenWRT
It's been working OK but today I decided to check out OpenWRT. So, I downloaded the image and flashed it. Unlike DD-WRT, there is not a web service readily running. As expected, Wi-Fi is not enabled at this point either. So, back to good ol' Putty and telnet/ssh business...

First Login
## http://wiki.openwrt.org/doc/howto/firstlogin
## First telnet (192.168.1.1:23)

login as: root
root@192.168.1.1's password:

BusyBox v1.22.1 (2014-06-03 08:07:42 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r40982)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------
root@OpenWrt:~#

Get the Web Interface Up
## Install LuCI (web) using ssh 192.168.1.1:22
## http://wiki.openwrt.org/doc/howto/luci.essentials

 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.22.1 (2014-06-03 08:07:42 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r40982)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------

# Let's get some help...
root@OpenWrt:/# help
Built-in commands:
------------------
        . : [ [[ alias bg break cd chdir command continue echo eval exec
        exit export false fg getopts hash help history jobs kill let
        local printf pwd read readonly return set shift source test times
        trap true type ulimit umask unalias unset wait

## OK. time to change password...
root@OpenWrt:/# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root

## Keep on following wiki...
root@OpenWrt:/# opkg update
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker.
root@OpenWrt:/# opkg install luci-ssl
Installing luci-ssl (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-ssl_svn-r10265-1_brcm47xx.ipk.
Installing luci (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci_svn-r10265-1_brcm47xx.ipk.
Installing uhttpd (2014-04-08-a0c33bdbc4873210598acdccb292ff77fb6bf624) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/uhttpd_2014-04-08-a0c33bdbc4873210598acdccb292ff77fb6bf624_brcm47xx.ipk.
Installing uhttpd-mod-ubus (2014-04-08-a0c33bdbc4873210598acdccb292ff77fb6bf624) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/uhttpd-mod-ubus_2014-04-08-a0c33bdbc4873210598acdccb292ff77fb6bf624_brcm47xx.ipk.
Installing luci-mod-admin-full (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-mod-admin-full_svn-r10265-1_brcm47xx.ipk.
Installing luci-mod-admin-core (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-mod-admin-core_svn-r10265-1_brcm47xx.ipk.
Installing luci-lib-web (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-lib-web_svn-r10265-1_brcm47xx.ipk.
Installing luci-lib-core (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-lib-core_svn-r10265-1_brcm47xx.ipk.
Installing lua (5.1.5-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/lua_5.1.5-1_brcm47xx.ipk.
Installing liblua (5.1.5-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/liblua_5.1.5-1_brcm47xx.ipk.
Installing libuci-lua (2014-04-11.1-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/libuci-lua_2014-04-11.1-1_brcm47xx.ipk.
Installing libubus-lua (2014-05-06-9fda19140e65457d967ff6fe424e420f656c06c9) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/libubus-lua_2014-05-06-9fda19140e65457d967ff6fe424e420f656c06c9_brcm47xx.ipk.
Installing luci-lib-sys (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-lib-sys_svn-r10265-1_brcm47xx.ipk.
Installing luci-lib-nixio (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-lib-nixio_svn-r10265-1_brcm47xx.ipk.
Installing luci-sgi-cgi (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-sgi-cgi_svn-r10265-1_brcm47xx.ipk.
Installing luci-proto-core (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-proto-core_svn-r10265-1_brcm47xx.ipk.
Installing luci-i18n-english (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-i18n-english_svn-r10265-1_brcm47xx.ipk.
Installing luci-lib-ipkg (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-lib-ipkg_svn-r10265-1_brcm47xx.ipk.
Installing luci-theme-bootstrap (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-theme-bootstrap_svn-r10265-1_brcm47xx.ipk.
Installing luci-theme-base (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-theme-base_svn-r10265-1_brcm47xx.ipk.
Installing luci-app-firewall (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-app-firewall_svn-r10265-1_brcm47xx.ipk.
Installing luci-proto-ppp (svn-r10265-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/luci-proto-ppp_svn-r10265-1_brcm47xx.ipk.
Installing libiwinfo-lua (49) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/libiwinfo-lua_49_brcm47xx.ipk.
Installing libustream-polarssl (2014-03-25-fc0b5ec804ee43c532978dd04ab0509c34baefb0) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/libustream-polarssl_2014-03-25-fc0b5ec804ee43c532978dd04ab0509c34baefb0_brcm47xx.ipk.
Installing libpolarssl (1.3.7-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/libpolarssl_1.3.7-1_brcm47xx.ipk.
Installing px5g (1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/px5g_1_brcm47xx.ipk.
Configuring luci-lib-sys.
Configuring liblua.
Configuring libuci-lua.
Configuring lua.
Configuring libubus-lua.
Configuring luci-lib-core.
Configuring luci-lib-nixio.
Configuring luci-sgi-cgi.
Configuring luci-lib-web.
Configuring luci-proto-core.
Configuring luci-i18n-english.
Configuring luci-mod-admin-core.
Configuring libiwinfo-lua.
Configuring luci-theme-base.
Configuring luci-theme-bootstrap.
Configuring luci-app-firewall.
Configuring luci-lib-ipkg.
Configuring uhttpd.
Configuring uhttpd-mod-ubus.
Configuring luci-mod-admin-full.
Configuring luci-proto-ppp.
Configuring luci.
Configuring libpolarssl.
Configuring libustream-polarssl.
Configuring px5g.
Configuring luci-ssl.
root@OpenWrt:/#

Almost there...
## Start the web server (uHTTPd)
root@OpenWrt:~# /etc/init.d/uhttpd start
Generating RSA private key, 1024 bit long modulus
Generating selfsigned certificate with subject 'C=DE;ST=Berlin;L=Berlin;CN=OpenWrt;' and validity 20140604233124-20160603233124
root@OpenWrt:~#

## login to web interface
https://192.168.1.1/cgi-bin/luci

Disappointment!
All good, and then I wanted to configure the wireless.That's when I realized I lost ability to use 802.11n. A bit of research and sure enough, only bg is supported.

OK, that's a deal breaker. Time to go back to DD-WRT or Stock image!

Unfortunately, every time I tried to use the firmware page, I got an error saying the firmware was not supported type. So, I got stuck. Then, I found instructions to do it from CLI and followed them

## Uninstall openwrt, and go back to stock Cisco E3000 stock firmware
http://wiki.openwrt.org/doc/howto/generic.uninstall

cd /tmp
wget http://downloads.linksys.com/downloads/firmware/1224655340609/FW_E3000_1.0.06.002_US_20140409_code.bin
mtd -r FW_E3000_1.0.06.002_US_20140409_code.bin firmware
rebooting...

Real Disappointment!!!
Unfortunately, that bricked the router = Blue Power Led kept on blinking forever!
I tried 30/30/30 reset; that did not bring back UI but got ping reply from 192.168.1.1

At this point, I was not sure if I could bring back the bricked router but kept on trying:

  • Directly connect PC network cable to Router
  • Open (elevated) Command Prompt (cmd)
  • cd /to/downloaded_dd-wrt-firmware_folder/ (for me c:\temp\w)
  • use tft to transfer firmware

 C:\Temp\w>tftp -i 192.168.1.1 put dd-wrt.v24-14929_NEWD-2_K2.6_std_usb_ftp-e3000.bin dd-wrt.v24-14929_NEWD-2_K2.6_std_usb_ftp-e3000.bin

Gave it 10secs and reboot (did not work). Then, while holding down reset button,

  • Disconnect Power Cable
  • Wait for 10secs
  • Reconnect Power Cable
  • Wait for 10 secs
Victory!
Voila! http://192.168.1.1 is accessible and Power Led is solid blue! My wireless router is back to life! OK,so I am back to where I was, but I think it is fair to call that a victory, right? Riiiight!

Time to reconfigure DD-WRT and blog this...experience!

Gist notes here as well: https://gist.github.com/AdilHindistan/0bfb376165313da693d0