Can't connect to router after executing ./mtd_erase -d linux

30 posts / 0 new
Last post
heath
heath's picture
Can't connect to router after executing ./mtd_erase -d linux

I was following along here:

http://www.myopenrouter.com/article/10496/How-To-Switch-Firmwares-on-the...

 The very last comment as of 21:03 Oct.12 2009 is my problem, it's pasted below:

 

 """

tftp> status
Connected to 192.168.1.1.
Mode: octet Verbose: on Tracing: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> put
(file) openwrt_wgr614l.chk
putting openwrt_wgr614l.chk to 192.168.1.1:openwrt_wgr614l.chk [octet]
tftp: sendto: Network is unreachable

What's
the problem? Also do I need a bin, trx, or chk? If anything other than
chk (maybe I'm wrong for even attempting to use this), where can I find
the download?

"""

 

The program used was the equivalent of tftp available in the repo for the distro I was using at the time. I thought I'd have another go at it tonight, and the new distro provides tftp, however, I am still presented with the network is unreachable error. Maybe I need to change the routing tables? I'll check them and report back the results in a little while.  

hvanderheide
hvanderheide's picture
Your PC is probably not in

Your PC is probably not in the same network range as the router. Check if your IP address is in the 192.168.1.x range.

heath
heath's picture
Whoops, I forgot to come back

Whoops, I forgot to come back and respond, route -n shows nothing. And I'm not really sure how to get any of it showing...

hvanderheide
hvanderheide's picture
If you are on Windows: Go to

If you are on Windows: Go to the conrol panel -> network connections -> local area connection. The support tab shows your IP address, properties button -> TCP/IP properties, allows you to change the IP address.

heath
heath's picture
I'm on linux, have been for

I'm on linux, have been for awhile and don't plan on changing :) I tried dhclient eth0 but I of course knew it wouldn't work since the cable modem is connected to the router which can't even boot up. I'm thinking that I need to manually insert addresses for the gateway and destination, but I'm not sure if that will affect the problem at all. And would someone mind explaining, as well, how it is that you can tftp into the router after deleting whatever it is that I deleted preventing it from booting...

retro98
retro98's picture
heath said:

heath said:
I'm on linux, have been for awhile and don't plan on changing :) I tried dhclient eth0 but I of course knew it wouldn't work since the cable modem is connected to the router which can't even boot up. I'm thinking that I need to manually insert addresses for the gateway and destination, but I'm not sure if that will affect the problem at all. And would someone mind explaining, as well, how it is that you can tftp into the router after deleting whatever it is that I deleted preventing it from booting...

You need to establish a static IP address (such as 192.168.1.2 mask 255.255.255.0) on the Linux PC you're using to fix the router. dhclient on the PC won't work, because you've already erased the DHCP server on the router.

You can run ping 192.168.1.1 on the PC to verify connectivity with the router, prior to attempting the tftp.

The explanation on why you can tftp into the router is because that function is part of the router's CFE boot loader (analogous to the PC's BIOS), and it's located in a flash partition separate from the router's linux partition. When the boot loader can't find Linux to start, it enters failsafe, and runs tftpd instead.

It's clearly not advisable to erase the router's boot loader, but that's a separate topic.

hvanderheide
hvanderheide's picture
Linux makes it indeed a lot

Linux makes it indeed a lot easier. Just run as root or sudo: ifconfig eth0 192.168.1.2 up.

Check if you can ping 192.168.1.1

Then use your tftp client (I use atftp) and: tftp -pl binary.chk 192.168.1.1

Schugy
Schugy's picture
tftp mode needs the boot wait

tftp mode needs the boot wait option. Are you sure it has been checked?

heath
heath's picture
Sorry to have responded late,

Sorry to have responded late, here's my attempt to place the chk file on the modem after reading the comments (and you thank you so much for the prompt help).

---

$ sudo -i
[sudo] password heath:    
~# ifconfig eth0 192.168.1.2 up
~# ifconfig lo up
~# ping 192.168.1.1 -c 3
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=100 time=1.88 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=100 time=1.88 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=100 time=1.88 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 1.882/1.883/1.886/0.050 ms
~# logout
$ ping -c 2 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=100 time=1.88 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=100 time=1.88 ms

--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 1.881/1.881/1.882/0.043 ms
~$ tftp
tftp> binary
tftp> connect 192.168.1.1
tftp> put openwrt_wgr614l.chk
Transfer timed out.
tftp> verbose
Verbose mode on.
tftp> mode binary
mode set to octet
tftp> put openwrt_wgr614l.chk
putting openwrt_wgr614l.chk to 192.168.1.1:openwrt_wgr614l.chk [octet]
Transfer timed out.

tftp> trace
Packet tracing on.
tftp> status
Connected to 192.168.1.1.
Mode: octet Verbose: on Tracing: on
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> timeout 30
tftp> put openwrt_wgr614l.chk
putting openwrt_wgr614l.chk to 192.168.1.1:openwrt_wgr614l.chk [octet]
sent WRQ
sent WRQ
sent WRQ
sent WRQ
sent WRQ
sent WRQ
Transfer timed out.

---

As you can see, it didn't quite work as planned. Schugy, I'm not aware of a boot option, the help and man page doesn't mention anything of it. retro98, thank you for answering both my questions.

Schugy
Schugy's picture
Your WGR614L is pingable,

Your WGR614L is pingable, tftp is working.
I've read that you can upload the file within the first seconds after plugging the power supply in. But for me it works if I just mark the put command with the mouse and use a middle click (+ enter if no linebreak marked too).
Then you can enter the put command a few times in a few seconds. AFAIK without a firmware it loads the bootloader, stalls and reboots again. Keep putting the file or try to adjust the mtu with ifconfig ethX mtu 1200 or delete your IPV6 IP with ifconfig ethX del ...... Or try a route del default.
I've never had probblems with putting a chk file onto the WGR614L.

hvanderheide
hvanderheide's picture
I have had some problems with

I have had some problems with TFTP to. For me it also would not work to get the firmware uploaded in the 3 seconds it should listen for the binary. So, I purchased a serial cable which really makes life easier. Just solder a header on the board so you can disconnect and close the router when your done. Then you don't have to worry you will block yourself out when you are fiddling with your firewall rules ;)

retro98
retro98's picture
I suggest attempting tftp-s

I suggest attempting tftp-s to the router continuously, while powering it (the router) up. If tftp transfer still doesn't engage, try power up with hard reset. And if that doesn't work, then a serial cable would be necessary to see what's happening at the router, and why the router isn't waiting for tftp transfer as we're expecting it should.

heath
heath's picture
~$ tftp

~$ tftp
tftp> binary
tftp> verbose
Verbose mode on.
tftp> connect 192.168.1.1
# and repeat the following over 10 times:
tftp> put openwrt_wgr614l.chk
putting openwrt_wgr614l.chk to 192.168.1.1:openwrt_wgr614l.chk [octet]
Transfer timed out.

I also unplugged the router and plugged it back in then tried putting immediately, but it didn't work, same error. I'm assuming that's what was meant by hard reset since I'm not seeing a reset button anywhere. It was difficult trying to put within 3 seconds of the router being plugged in. I tried the following originally:

tftp -m binary 192.168.1.1 -c put openwrt_wgr614l.chk

but it just got me to the tftp prompt. So where to go from here? Maybe I did something wrong? And again, I really can't thank you all enough for your generous help.

Schugy
Schugy's picture
Hard reset means:

Hard reset means:
hold down the reset button
power the router up
keep the reset button held down for 30 seconds.

There's a well hidden reset button in a metal hole next to the antenna. There's also a short description on the label on the bottom of the router.

heath
heath's picture
Looks like I will have to

Looks like I will have to purchase a serial cable, though I don't see a port for it. Is there a walkthrough on restoring the router using a serial cable?

heath
heath's picture
I found this but it's for

I found this but it's for Windows, anything for linux?

http://www.myopenrouter.com/article/10341/Recover-Your-WGR614L-Using-a-S...

heath
heath's picture
Is there a recommended place

Is there a recommended place for purchasing a serial cable, mouser.com was linked to in the article linked above, but they are out of stock.

EDIT
The part was just obsolete, they recommended this one to me:
http://www.mouser.com/Search/ProductDetail.aspx?R=895-TTL-232R-3V3-2MM&b...

hvanderheide
hvanderheide's picture
I ordered mine at farnell.com

I ordered mine at farnell.com, but that might not be so easy for you. I ordered the FTDI TTL-232R-3V3. If you solder a pinheader on the print you can easily connect the cable to the board and disconnect when you're done.

The FTDI chip embedded in the cable is recognised by Linux. Just install and open Putty and point it to serial /dev/ttyUSB0. Also set the baudrate to 115200. When it doesn't work check the permissions on /dev/ttyUSB0. If I remember correctly I also had to load a kernel module.

heath
heath's picture
Alright, so I got the serial

Alright, so I got the serial cable in, ripped out the wires from the plastic head, stripped them, soldered them as described in http://www.myopenrouter.com/article/10341/Recover-Your-WGR614L-Using-a-S... and then downloaded ftdi-eeprom, libftdi-dev, libftdi1, libftdipp-dev, libftdipp1, python-ftdi, and python2.6-ftdi from the Ubuntu repositories, so I'm guessing one of those is the driver needed to recognize the serial connection. But what to do now, the guide is for Windows.

After plugging the the yellow ethernet cable to the cable modem and network router, I then plugged another ethernet cable to the computer and my network router. From the command line, ifconfig showed that eth0 (my wired connection) didn't have an ipv4 IP address. I tried from within tftp to connect using the ipv6 address, I figured it would fail and it did. If someone could help me at this point, you deserve some major whuffie. And thanks to everyone for getting me this far.

heath
heath's picture
I was inspired by this thread

I was inspired by this thread: http://www.myopenrouter.com/forum/thread/15549/Another-bricked-router-th...

He was going through the same thing I am with the same distro, so I looked and indeed there is a Putty client for Ubuntu, this is as far as I'm able to get: http://imgbin.org/images/1076.png ..that is starting tftpd but not able to send to the router... If you look at the image, the putty console has text which reads "gateway not set, nameserver not set". I didn't manually set the IP address, maybe that's the issue? If so, how would I go about doing this?

hvanderheide
hvanderheide's picture
You don't need a gateway or

You don't need a gateway or nameserver for tftp, but your PC has te be in the same subnet as your router to be able to connect. In this case your PC has to have an IP in the 192.168.1.x range. "sudo ifconfig eth0 192.168.1.10 255.255.255.0 up" should do the trick.

heath
heath's picture
Hrm, same error after trying

Hrm, same error after trying that. See screenshot for reference:

http://imgbin.org/images/1081.png

hvanderheide
hvanderheide's picture
The webpage with your

The webpage with your screenshot won't load, but here is a short checklist:

- Make sure your computer is directly connected to your router, bot not on the WAN port.
- Make sure both your router and your computer are in the same subnet, likely 192.168.1.x
- Make sure you have the tftp daemon running on your router, type "tftpd" in the routers CFE bootloader console
- Check if the LAN port lights are on
- Check if you can ping your router from your computer
- tftp your .chk image to your router

Hope this helps

heath
heath's picture
I'm not able to ping the

I'm not able to ping the router, and I'm not exactly sure how to make sure both the router and computer are in the same subnet. As you can see, I've attempted to assign an ip address and subnet mask, but failed this time around. I'm definitely going to need some answers or sources to read in order to get around my lack of knowledge in this area.

~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:9e:4b:3b:0a
inet6 addr: fe80::226:9eff:fe4b:3b0a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:736336 errors:0 dropped:0 overruns:0 frame:0

TX packets:232879 errors:0 dropped:0 overruns:0 carrier:27
collisions:0 txqueuelen:1000
RX bytes:205294452 (205.2 MB) TX bytes:37030342 (37.0 MB)
Interrupt:30

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:45216 errors:0 dropped:0 overruns:0 frame:0
TX packets:45216 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1343868 (1.3 MB) TX bytes:1343868 (1.3 MB)

wlan0 Link encap:Ethernet HWaddr 00:1e:64:11:34:be
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:138709 errors:0 dropped:0 overruns:0 frame:0
TX packets:114167 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:144550214 (144.5 MB) TX bytes:17606797 (17.6 MB)

wmaster0 Link encap:UNSPEC HWaddr 00-1E-64-11-34-BE-00-00-00-00-00-00-00-00-00-00
UP RUNNING MTU:0 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

~$ sudo ifconfig eth0 dstaddr 192.168.1.10 netmask 255.255.255.0 up
[sudo] password for heath:
SIOCSIFDSTADDR: Cannot assign requested address
SIOCSIFNETMASK: Cannot assign requested address

heath
heath's picture
I just did sudo ifconfig

I just did

sudo ifconfig eth0 192.168.0.0 netmask 255.255.255.0

but I don't think that sets the router's IP.

Here's the output in putty:

Decompressing..........done

WGR614v8 - 1.5 (Fri Jun 6 15:53:24 CST 2008)
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 4.130.30.0
Device eth0: hwaddr 00-22-3F-6B-9B-D4, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
CFE> ^C
CFE> tftpd
Reading ::

This is my attempt to ping the router:

$ ping -c 2 192.168.1.1
connect: Network is unreachable
$ ping -c 2 192.168.1.2
connect: Network is unreachable
$ ping -c 2 192.168.1.3
connect: Network is unreachable
$ ping -c 2 192.168.1.4
connect: Network is unreachable
$ ping -c 2 192.168.1.5
connect: Network is unreachable
$ ping -c 2 192.168.1.6
connect: Network is unreachable
$ ping -c 2 192.168.1.7
connect: Network is unreachable
$ ping -c 2 192.168.1.8
connect: Network is unreachable
$ ping -c 2 192.168.1.9
connect: Network is unreachable
$ ping -c 2 192.168.1.10
connect: Network is unreachable

hvanderheide
hvanderheide's picture
You should not change your

You should not change your routers IP, just your computers temporarily. If your set your computers IP to 192.168.1.10 and connect it directly to your router, you should be able to ping 192.168.1.1 from your computer. If you succeed you should send your image from your computer to 192.168.1.1.

heath
heath's picture
I'm unable to ping 192.168.1

I'm unable to ping 192.168.1.1 through 192.168.1.9 while my computer's ip is set to 192.168.1.10, so it's impossible to send anything via tftp. If the router can start tftpd, what other programs does it have at its disposal?

hvanderheide
hvanderheide's picture
I'm not sure you are doing it

I'm not sure you are doing it right. Is your computer directly connected to your router? And what is your output for ifconfig and ping 192.168.1.1?

Schugy
Schugy's picture
And hopefully not the WAN

And hopefully not the WAN port.....

retro98
retro98's picture
The earlier output of

The earlier output of ifconfig on the Linux PC shows its eth0 has no IP address. To set one:

# ifconfig eth0 192.168.1.10 up

Then check that it is set:

# ifconfig eth0

Without properly configured NICs, "sendto: Network is unreachable" is a common error. Also the connect message from tftp is misleading. No real network xmits occur until the put command starts, and that's when the networking errors occur.