Showing posts with label WRT54G. Show all posts
Showing posts with label WRT54G. Show all posts

2012-05-29

(Re)installing OpenWRT on a WRT54G

Every once in a while, I find that I want to upgrade my WRT54G in a clean fashion. And every once in a while, it's a massive struggle to make it behave as I want to, as I find that the defaults of OpenWRT are very restrictive.

First of all, here's the network configuration I want use OpenWRT in:
  • 192.150.23.1: Internet gateway + firewall
  • 192.150.23.2: WRT54G as a wireless + wired router
  • 192.150.23.3: LAN SOHO server (DHCP + DNS, Samba, etc)
As stated, I want the WRT as 192.150.23.2 acting as a mere router with any wireless or wired connection should have complete and transparent access to the LAN, with no firewalling (the internet gateway does it) and no DHCPing. Should be simple, but unless you've done it before, it's usually a PITA to configure.

OK, so first let's start by installing/resetting our firmware.
At the time of this post the latest version of OpenWRT is Backfire 10.3.1. With a WRT54G the download directory you're interested in is brcm47xx/. Now, with regards the confusing content of the directory and its numerous files, the only one you are interested in is openwrt-brcm47xx-squashfs.trx (the .trx). The .bin files are only there for users of the original Linksys firmware. The admin console should let you go through the upgrade nicely, else you'll find various upgrade/install tutorials in the OpenWRT HOWTOs section.

Now, assuming you have the latest firmware installed, you may want also want to reset the settings to default. There are multiple ways to do just that, as indicated on the OpenWRT failsafe guide. Since I tend to use the serial connection to ensure that I can access the WRT no matter what, my preferred way is just to enter the failsafe mode through the serial console with f+Enter when prompted, and then issue:
firstboot
reboot -f


We will now assume that the router has been reset to its intial boot parameters. In this configuration, the default address is 192.168.1.1 so you'll probably want to configure a network interface with a static address of 192.168.1.2 and connect it to one of the 4 ethernet port of the router (but not the 5th "internet" port, as this one is firewalled by default and you won't be able to access the console from it).

OK, with the web interface accessible at 192.168.1.1, we'll do the following:
  1. In Network → Firewall, delete the LAN and WAN firewall zones and set all the defaults in general settings to "accept". Click save and apply.
  2. In Network → Static Routes add a route with the following parameters:
    • Interface: lan
    • Target: 192.150.23.0
    • IPv4-Netmask: 255.255.255.0
    • IPv4-Gateway: 0.0.0.0
    • Click save and apply
  3. In Network → Switch:
    • Delete VLAN #1
    • Mark all ports of VLAN #0 as untagged
    • Click save and apply
  4. In Network → Interfaces:
    • Delete the WAN network
    • Edit the LAN network and in General Setup, make sure the Protocol is set to "Static address" and change it to 192.150.23.2
    • Add 192.150.23.1 as a gateway and 192.150.23.3 as custom DNS
    • Also make sure to check the "Disable DHCP for this interface" option
    • Save (but don't apply)
  5. In Network → Interfaces → Physical Settings:
    • Add "VLAN Interface: "eth0.1""
    • Make sure "creates bridge" is selected and enable STP if desired
    • Click save and apply.
    After a while, you should be able to reconnect to the router using 192.150.23.2.
From that stage you should have full access to the network and you should be able to configure the other options such as WLAN and additional packages.


You can also fine tune your network config by editing /etc/config/network. Don't forget to issue a
/etc/init.d/network reload when you're done.


Finally, you may want to note that the power supply that Linksys providess with the WRT54G sure is a piece of crap (at least the early ones - I can only hope they have improved on that): even when disconnected and therefore not supplying any power to the router, the PSU consumes 3 Watts (!), or about half of what the device actually uses when active. Talk about wasting watts for nothing...

2008-07-10

adding a 2GB SD card on a WRT54G with openWRT

It's been documented to death, so I'm not gonna bother telling you how exactly I did it. Just make sure you use the optimised mmc.o driver from http://forum.openwrt.org/viewtopic.php?id=9653.

I will however document the errors you can get when there's something wrong with your soldering, as I can attest that, if it doesn't work, it doesn't come from the card or the code, it comes from lousy soldering.

o [FATAL] mmc_card_init: invalid response from card: 03 found, waiting for 01

There is a short between your CLK line (usually GPIO3) and your DI line (usually GPIO2)
This can happen if your connection to the white LED is also touching the amber LED. TRIPLE check that your solder points are clean between the 2 front LEDs


o [WARN] mmc_init: impossible to get card indentification info for reason code: 01
o [FATAL] mmc_init: got an error when trying to get card configuration registers: 02


This one's a lot trickier. Just make sure you have the gpio tool at hand, and watch the amber LED closely. By default, it should be completely off. Then issue "gpio disable 3" and then "gpio enable 3". If you can now see a small residual light on the LED, that didn't exist before, then your LED is screwed and therefore your CLK is screwed.
Always make sure that your "enabled" voltages on GPIO are 0V and stay 0V.

I ended up removing the Amber LED (after a test using GPIO5 confirming that I had indeed an issue with GPIO3) and now everything works like a charm.

Oh, and if you're running in mixed mode (root fs still using the onboard flash), chroot is your friend to install packages on the card with ipkg.