OpenWrt & Linksys WRT54GL Router – Meet & Greet

OpenWrt is a firmware for embedded devices used to router traffic. In this case we will be considering the use of OpenWRT in domestic routers such as the test hardware Linksys Wireless-G Broadband Router WRT54GL v1.1.

OpenWrt is Linux based so it included the Linux kernel as well as BusyBox. It has a package manager called opkg (similar to apt in ubuntu).

Before installing OpenWrt on a router, you must enable that the device is OpenWrt compatible, you can do this my ensuring the device is listed here 

HARDWARE SPECIFICATIONS

Before exploring OpenWrt, We are going to take a closer look at the hardware available:

CPU: Broadcom BCM5352 @ 200 MHz
RAM: 16 MB
Flash Memory:  4 MB

QUICK CHECK – to ensure the hardware is what we believe it to be, we can check the prefix of the serial number using the information here 

This hardware is fully supported by OpenWrt, but there have been issues with the limited amount of flash memory:
http://wiki.openwrt.org/toh/linksys/wrt54g#hardware
https://forum.openwrt.org/viewtopic.php?id=28223

The solution to this issues, has also been documented. This is to use OpenWrt 8.09 r14511 (code name “kamikaze”) instead of the most up-to date version OpenWrt 10.03.1-rc6 (code name “backfire”)

PICKING A VERSION

To start with we are going to install OpenWrt in Linksys Web GUI. There are many versions of OpenWrt available, so we need to identify to first version we will try:

  • The OpenWrt version is Kamilaze, due to a bug in backfire and instability of attitude adjustment
  • The recommended version is 8.09 within Kamilaze
  • The CPU is broadcom so the prefix is bcrm
  • For here, i can see the hardware supports both brcm-2.4 and brcm47xx
  • The difference between brcm-2.4 and brcm47xx is explained here 
  • For ease, we will download a image file, this will end with .bin
  • If both JFFS2 and SquashFS is available, use SpuashFS images
  • Look into the version history to determine with version of 8.09 is best and what is different between kamikaze, backfire and attitude adjustment

The image I am going to test is  http://downloads.openwrt.org/kamikaze/8.09/brcm-2.4/openwrt-wrt54g-squashfs.bin

INSTALLATION

Step 1: Download http://downloads.openwrt.org/kamikaze/8.09/brcm-2.4/openwrt-wrt54g-squashfs.bin to my Downloads directory
Step 2: Plug in router to mains and to computer via ethernet (use port 1 not internet port)
Step 3: Direct the browser to http://192.168.1.1 and log in
Step 4: Navigate to Administation > Firmware update, select openwrt-wrt54g-squashfs.bin and update

ALL IS LOOKING WELL 🙂

COMMUNICATION VIA WEB GUI 
Direct the browser to http://192.168.1.1, log in and your presented with the web interface luci

COMMUNICATION VIA TELNET
The router should now be telnet(able) to 192.168.1.1. To test this:
$ telnet 192.168.1.1
This returns the recipe for KAMIKAZE 🙂

Now to ensure that tftp is available to prevent bricking, enter:

  $ nvram set boot_wait=on
  $ nvram set boot_time=10
  $ nvram commit && reboot


 COMMUNICATION VIA SSH

CONFIGURING 

The network configuration is stored in /etc/config/network. The initial contents of this file for our set up is:

The content of the initial configuration file is

 #### VLAN configuration
config switch eth0
option vlan0    “0 1 2 3 5*”
option vlan1    “4 5”

#### Loopback configuration
config interface loopback
option ifname   “lo”
option proto    static
option ipaddr   127.0.0.1
option netmask  255.0.0.0

#### LAN configuration
config interface lan
option type     bridge
option ifname   “eth0.0”
option proto    static
option ipaddr   192.168.1.1
option netmask  255.255.255.0

#### WAN configuration
config interface        wan
option ifname   “eth0.1”
option proto    dhcp

Once we have edited this file, to make the new configuration take after we need to :
$ /etc/init.d/network restart

SWITCH
The switch section of the above configuration file is responsible for making one peoice of hardware, appear as several independent interfaces. The part of the configuration file which specifies the switch characteristics is:

 #### VLAN configuration
config switch eth0
option vlan0    “0 1 2 3 5*”
option vlan1    “4 5”

In the above configuration: The numbers 0-5 represent the port numbers, so VLAN0 includes ports 0 to 5* and VLAN1 includes ports 4 and 5. The * in 5*
indicates the PVID.

As shown in the above diagram, this switch separates the LAN ports and thWAN ports .

INTERFACES
The other statements in the configuration file describe the interfaces. The interfaces are logical networks, for the setting of IP address, routes and other magic.

The 3 interfaces that we have here are named loopback, lan and wan. The physical interfaces associated with these logical interfaces are lo, eth0.0 and eth0.1.

 

Leave a Reply