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...

No comments:

Post a Comment