OpenWRT Linux distribution on the Linksys WRT54G v2.2

Friday, January 21 2005 @ 10:52 PM CET

Contributed by: bart

Linksys uses Linux on their WRT54 and WAP54 series of wireless routers and access points.
Because of the availability of the source code for the Linux version as it runs on this device, there exist several alternatives for the Linksys provided firmware.

I have a WRT54G v2.2 myself, and for this device one has a few choices.

If you are very comfortable with Linux, OpenWRT is te thing for you. It provides a very minimal Linux distribution and removes many of the Linksys applications. You'll have to be very comfortabel with commandline Linux for using this, but it allows you to configure your router/access point to become anything you want.

In my case all the AP functionality has been disabled and it functions as a client on another access point.

Bridging between the ethernet 'lan' and the wireless network has been disabled, and the wan port no longer exists as such but is a 5th lan port. The lan ports are divided into 3 vlans and the device functions as router and firewall between the vlans and the wireless lan.

The Linux version is an embedded 2.4.20 for mips and is a tiny but pretty complete system including a very nice commandline package manager. A variety of usefull packages exist including snort and routing management software, allowing one to build a nice switch with wireless capabilities, bridging and enterprise level configuration

The Linux distribution also includes the wl tool from Linksys and Broadcom for using the wireless interface. The radio in this device is quite good, and reception even with the standard set of 2 antennas is very good. This makes it an ideal device for tasks like running kismet and relatively long distance wireless bridging.

My setup also has an nfs client installed so I can make use of remote filesystems instead of constantly writing to the flash rom. The root filesystem is a jffs2 filesystem on the flash rom of the device and since it can be written to a limited number of times, it is better to not write to it when not strictly needed.

A bit of output from uname and lsmod:

root@gatekeeper:/# uname -a
Linux OpenWrt 2.4.20 #1 Tue Jan 11 22:51:19 SAST 2005 mips unknown
root@gatekeeper:/# lsmod
Module                  Size  Used by
nfs                    90000   0 (unused)
lockd                  61908   0 [nfs]
sunrpc                 84656   0 [nfs lockd]
wl                    401592   0 (unused)
et                     27328   0 (unused)
diag                    2224   0 (unused)

And this is what top looks like now on my router.

Mem: 8184K used, 6072K free, 0K shrd, 856K buff, 2700K cached
Load average: 0.00, 0.00, 0.00    (State: S=sleeping R=running, W=waiting)

  PID USER     STATUS   RSS  PPID %CPU %MEM COMMAND
    3 root     SWN        0     1  1.3  0.0 ksoftirqd_CPU0
  374 root     S        604   348  0.5  4.2 dropbear
  544 root     R        400   375  0.5  2.8 top
  375 root     S        544   374  0.0  3.8 ash
    1 root     S        372     0  0.0  2.6 init
  348 root     S        368     1  0.0  2.5 dropbear
   33 root     S        344     1  0.0  2.4 syslogd
   32 root     S        304     1  0.0  2.1 klogd
    7 root     SW         0     1  0.0  0.0 mtdblockd
    2 root     SW         0     1  0.0  0.0 keventd
    4 root     SW         0     1  0.0  0.0 kswapd
   16 root     SWN        0     1  0.0  0.0 jffs2_gcd_mtd
    5 root     SW         0     1  0.0  0.0 bdflush
    6 root     SW         0     1  0.0  0.0 kupdated

A partial list of the packages available on OpenWRT using the ipkg package manager:

admcfg - WRT54G adm configuration kernel module and binary
chillispot - a wireless access point controller
dhcp-fwd - a DHCP relay agent
dropbear - Lightweight SSH client and server system
fprobe - a NetFlow probe
ip - iproute2 stuff
ip6tables - Linux kernel 2.4+ IPv6 packet filter administration tools
kismet - Wireless 802.11b monitoring tool
kmod-ipt6 - ip6tables kernel modules
kmod-ipv6 - Kernel modules for the IPv6 protocol
kmod-nfs - NFS kernel modules
kmod-ppp-async - PPP async serial channel driver kernel module
kmod-ppp-mppe-mppc - Microsoft PPP compression/encryption (MPPC/MPPE) kernel module
kmod-sched - Traffic Control (TC) kernel modules
kmod-tun - Universal TUN/TAP device driver kernel module
libmatrixssl - an embedded SSL implementation
libpcap - a low-level packet capture library
libpthread - POSIX threads library
libssl - OpenSSL libraries used for SSL encryption.
ntpclient - utility to setting system time from NTP server
oidentd - A nat aware identd daemon/redirector
openssh-client - The OpenSSH client. Allows for access to remote systems via the SSH protocol.
openssh-client-extras - Various optional OpenSSH client tools.
openssh-server - The OpenSSH server daemon.
openssh-sftp-client - OpenSSH Secure FTP server.
openssh-sftp-server - OpenSSH Secure FTP server.
ppp - a Point-to-Point Protocol (PPP) daemon
pppoecd - Linksys PPPoE daemon for access to internet using DSL modems
ppp-radius-plugin - a RADIUS plugin for the PPP daemon
pptp-client - a Point-to-Point Tunneling Protocol (PPTP) client
pptp-server - a Point-to-Point Tunneling Protocol (PPTP) server
quagga-bgpd - Quagga BGP routing daemon
quagga-full - Quagga routing suite (ripd, ripngd, ospfd, ospf6d and bgpd)
quagga-ospf6d - Quagga OSPF IPv6 routing daemon
quagga-ospfd - Quagga OSPF routing daemon
quagga-ripd - Quagga RIP routing daemon
quagga-ripngd - Quagga RIPng routing daemon
quagga-zebra - Quagga zebra meta-routing daemon
radvd - Routing Advertisement Daemon for IPv6
strace - A system call tracer
tc - iproute2 stuff
tcpdump - A Tool for network monitoring and data acquisition. BSD licensed.
tspc - Provides a Freenet6 TSPC client for IPv6.
vsftpd - a fast and secure FTP server
wondershaper - Wondershaper qos management
zlib - zlib is a library implementing the 'deflate' compression system used by many programs.
noip - No-IP.com Dynamic DNS update client

Version 2.2 of the WRT54G is equiped with a 200mhz MIPS R3000 cpu and offers plenty of cpu power for most things you might want to do with a router, including fairly complex IDS and webserver configurations. The G model comes with 16mb memory, the GS model with 32, and the later is preferable if you want to run more serious applications.

If you need anything that writes to the filesystem often, you will want to mount an external filesystem with nfs or by modifying your device so you can conect storage to the USB controller (it has one, but no outside conenction ot it, just like it has 2 serial ports but again no outside conenctions).

You also have to be very carefull with what you do when configuring the router and even more when changing any of the scripts or adding software to be started on boot. You can lock yourself out of the device, and you may be left with no option oother then clearing the flash entirely, which invloves opening the device and causing a short circuit on 2 pins of the flash chip). While configuring it from the commandline is very powerfull, changing the boot configuration requires taking extreme care and testing everything you do.

If you are comfortable with such a setup then you get a very usefull and powerfull device. You have a programmable ethernet switch, bridging and routing, hardware for tkip and aes encryption and a wireless nic that is completely controllable from the commandline and provides a rather extended interface, the ideal device for custm wireless solutions.

If you consider modifying the hardware also, the first thing to look for is connecting serial port 1 so you have a serial console on the device. This way you can messup the network configuration without lockign yourself out. usb is another thing to consider since it allows you to connect a lot more storage easily.

Additional information on this device can be found in the SeatleWireless

Jan. 23th 2005, corrected some errors and added list of available packages

See alternative uses for the Linksys WRT54G for more information on running OpenWRT on v2.2 hardware.

7 comments



http://soapbox.bartsplace.net/article.php/20050121225259975