{"id":196,"date":"2010-04-07T12:15:10","date_gmt":"2010-04-07T04:15:10","guid":{"rendered":"http:\/\/play.datalude.com\/blog\/?p=196"},"modified":"2010-04-07T12:18:23","modified_gmt":"2010-04-07T04:18:23","slug":"adventures-in-unbricking-a-router","status":"publish","type":"post","link":"https:\/\/play.datalude.com\/blog\/2010\/04\/adventures-in-unbricking-a-router\/","title":{"rendered":"Adventures in unbricking a router"},"content":{"rendered":"<p>Another fantastic illustration of how Linux 'gets the job' done. Although sometimes the operator (ahem) is sometimes a bit slow on the uptake.<\/p>\n<p>Anyway, I had a Linksys WRT54G router in which the wireless unit had blown up after a power outage and surge. Gotta love the Philippines. I had dd-wrt on it, but decided to try out OpenWRT. Well lets just say that OpenWRT isn't to my taste. I wanted something which worked more or less immediately, rather than poring over documentation trying to figure out how to get the WAN interface up via a command line.<\/p>\n<p>So I dropped the router into a drawer until today, when I needed to use it for something (without the need for wireless). Well of course when I needed it, it wouldn't boot. In fact I couldn't even ping it. This is bad news.<\/p>\n<p>I tracked down an internet post which mentioned that if I held the reset button while booting, the router would go into admin mode, which meant I could ping it. I did this and it worked. I read elsewhere that in order to flash it with tftp, I needed to do so when the ping response time was 100ms, before it dropped to 64ms. Exciting stuff. I set up the tftp flashing machine and tried, possibly 50 or 60 times, to flash back ddwrt. No luck. For reference, here is the one liner:<\/p>\n<pre>echo -e \"binary\\nrexmt 1\\ntimeout 60\\ntrace\\nput ddwrt.bin\\n\" | tftp 192.168.1.1\r\n<\/pre>\n<p>I did an nmap scan of the router and found that port 23 was open, so I managed to telnet into it. I couldn't connect the wan interface (as previously noted), but I had a command prompt. No SSH, no web interface. So how to get the ddwrt.bin file onto the router via telnet?<\/p>\n<p>Here's how: On my PC, at 192.168.1.50, I went to the directory which held the ddwrt.bin file. At the command prompt I typed<\/p>\n<pre>python -m SimpleHTTPServer<\/pre>\n<p>This serves up the current directory over HTTP, port 8080.<\/p>\n<p>In my router telnet session I went to the \/tmp directory (the only place with enough space for the file) and typed<\/p>\n<pre>wget http:\/\/192.168.1.50:8080\/ddwrt.bin<\/pre>\n<p>After a few seconds, the file was there! Alright!<\/p>\n<p>Still in the router, I did<\/p>\n<pre><code>mtd -r write dd-wrt.bin linux<\/code><\/pre>\n<p>The router whirred for a while, rebooted and &#8230; ddwrt was back, in all its web-interfacy autoconfigurating glory.<\/p>\n<p>What a great trick with SimpleHTTPServer. Shame I wasted hours on the tftp approach. Incidentally, there's a similar tool which will let people upload files to your computer via HTTP, called droopy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another fantastic illustration of how Linux 'gets the job' done. Although sometimes the operator (ahem) is sometimes a bit slow on the uptake. Anyway, I had a Linksys WRT54G router in which the wireless unit had blown up after a power outage and surge. Gotta love the Philippines. I had dd-wrt on it, but decided &#8230; <a title=\"Adventures in unbricking a router\" class=\"read-more\" href=\"https:\/\/play.datalude.com\/blog\/2010\/04\/adventures-in-unbricking-a-router\/\" aria-label=\"Read more about Adventures in unbricking a router\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,4],"tags":[124,125,123,126,127],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-it","category-linux","tag-dd-wrt","tag-flash","tag-openwrt","tag-router","tag-simplehttpserver"],"_links":{"self":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/comments?post=196"}],"version-history":[{"count":0,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"wp:attachment":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}