This is mostly straight from the OpenWRT site. I'm using the WRT54G v 2.2 mentioned in The LinkSys WRT54G revisited.
Procedure 15. Debricking
Fail
I needed to debrick because the installation of OpenWRT failed. That's the reason I'm TFTP'ing an OpenWRT image, as opposed to the latest official firmware.
Unplug the device
Just power it off.
Connect the WRT54G to a computer
Put an ethernet cable between the PC and one of the LAN ports of the WRT54G, and give the NIC on the PC an IP:
apprentice@host:~$ ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
A little script to upload the new firmware during boot
The DD-WRT Wiki tells how to interpret the LED blinking at powerup. I adjusted one of the scripts at that page, after reading WRT54 Tips:
while ! ping -W1 -c1 -q 192.168.1.1 -q >/dev/null 2>&1 ; do sleep .1 ; echo -n . ; done cat <<EOF|tftp 192.168.1.1
bin
put openwrt-wrt54g-squashfs.bin
EOF
ping 192.168.1.1
The image can be fetched from the OpenWRT fileserver.
Connect to the web interface
Directing a browser to 192.168.1.1 shows that the upload somehow did succeed.
Procedure 16. Ensure TFTP availability
Enable SSH
From the PC, log onto the WRT54G using telnet, and set the root password.
Enable the TFTP boot timeout
Following the WRT54G-specific installation HOWTO, say:
nvram set boot_wait=on
nvram set boot_time=10
nvram commit && reboot
Sysupgrade
Upload openwrt-brcm47xx-squashfs.trx, and, till following the Wiki, do
root@OpenW:~# sysupgrade /tmp/openwrt-brcm47xx-squashfs.trx
Securing SSH
Configure DropBear to listen on the WAN port, and make it use keys for root (in /etc/dropbear/authorized_keys
), not passwords:
root@OpenWrt:~# sed -i "/RootPasswordAuth/ s/'on'/'off'/" /etc/config/dropbear
(We'll restart dropbear later.)
Configure wireless
root@OpenWrt:~# mv /etc/config/wireless /etc/config/wireless.dist
root@OpenWrt:~# wifi detect>/etc/config/wireless
root@OpenWrt:~# sed -i 's/option disabled 1/option disabled 0/' /etc/config/wifi
root@OpenWrt:~# /etc/init.d/network restart