Hacking Wireless Routers
Wireless routers are very cheap and have been widely deployed in SOHO and public WiFi hotspots. Many routers can be upgraded or enhanced by different firmware distributions. People can use a router as the perfect platform to learn embedded Linux. Recently I am interested in building my hotspot with the wireless router. It is not a fresh idea though. I just evaluate different open source solutions and plan to setup an online back-end service, which reliefs people from building their own hotspot servers. The requirement for back-end server is various for theWiFi hotspot captive portal. The simplest solution NoCatSpalsh only requires single HTML page on web server or local JFFS2 disk. The complicated solution requires PHP 5 and PostgreSQL database, which is only available a few virtual hosts (since MySQL is the most popular database). As a classic solution, you have to rent an entire host to fully control the server to setup RADIUS, LAMP and CA certificate. The server part is beyond scope of the article. Let us focus Linux on routers.
Off-the-shelf Hardware & Firmware Distributions
Most of the wireless routers are using Linux and VxWorks. Linksys reveals its Linux source code on its web site after a lawsuit ofWRT54G against GPL. You can check out the whole story in Wikipedia. WRT54G is an 802.11g wireless router, originally designed with Linux. However, WRT 54G became the most popular model since Linksys released the source code for each devices and each versions. Even today, Linksys turns to VxWorks from Linux, its open source versionWRT54GL is still available for Linux fans. And WRT54G and its family becomes an industrial standard of the SOHO router. Many models from ASUS, Buffalo, Netgear, Belkin and Accton are so-called WRT54G compatible routers. So, even Linksys quits the DIY market, you still can get compatible models from these suppliers with similar or more powerful hardware. For example, Buffalo andASUS manufactures some models with bigger memories and USB host ports. You can modify the firmware to transform it into a BitTorrent client (connects USB HDD), VoIP gateway (by Asterisk software), video surveillance system (connects web camera) or Mobile router (connects 3G mobile phone).
Besides the official release from Linksys, many open source communities have released Linux distributions on WRT54G platform.
- OpenWRT (introduces JFFS2 and ipkg package management to make it very versatile and adaptable, with Lua and optional X-WRT web UI)
- DDWRT (comes from Sveasoft MIPS Linux for Alchemy, revised to OpenWRT based since v23)
- HyperWRT (a project trying to enhance original firmware with enterprise features)
- Tomato (HyperWRT derivate project, features AJAX and SVG web UI)
Most of the 3rd party distributions for wireless routers are designed for Broadcom MIPS chip-set, some of them have migrated to other platforms includingAtheros (ARM9), Intel's IXP (XScale), PowerPC, Alchemy, AVR32, MikroTik (x86), RDC(x86) platforms. Until now, some drivers for the WLAN part are still using non open source modules.
As a Developer
Let us focus on OpenWRT. As a developer, you can use it in industrial control systems, small robots, sensor networks, home control solutions, VoIP systems, both wired and wireless networks and a whole lot more. You can download the pre-compiled image or check out the source code by Subversion.
Traditionally, the developer has to collect everything to build an embedded Linux by themselves, from cross compilers to kernels and patches. It is also a headache to track different versions. Apparently,OpenWRT uses a much simpler approach. It uses Buildroot to make the building process apparent to the users (developers). You can refer to the document page 'An introduction to Buildroot-ng' from OpenWRT.
- Download OpenWRT (Subversion is used to check out everything.)
- Directory Structure (The check out sources include toolchain, target and package.)
- Building OpenWRT (make menuconfig to config your distro, then make it. The makefile only prompts high level make process.)
- Creating Packages (Use high level package definition and makefile
to define your own packages, which can be enabled in next make
menuconfig.) - Troubleshooting (Always use make V=99 to see verbose information during build.)
- Burning the firmware (Open Linksys Web UI to download the
firmware, you may need modify the leading bytes of firmware to download)
The last step, burning the firmware to the flash memory is the most risky step. Incorrect programming procedure will brick your routers. Before that, please read the warning information carefully! Otherwise you have to build aJTAG cable to download the firmware.
If everything goes well, you have a router with much fun and more features! You can access the router via Web UI or Telnet/SSH. If you have enough flash memory (bigger than 4MB), you can mount JFFS2, and install extra packages or store more content on the router. Of course, you also can use external memory to achieve same purpose, such as NFS, CIFS, USB mass storage devices.
Solutions for Hotspot
A complete captive portal solution of hotspot is made up of wireless access point, access controller (or network access server), authentication server (or radius server for authentication, authorization and accounting), web server and administration software. A wireless router usually acts both WAP and AC.
DD-WRT offers most hotspot solutions, including Spuntik, ChilliSpot, WiFidog, NoCatSplash. OpenWRT offers CoovaChilli and other solutions by ipkg manager.
Usually people will select OpenWRT/DDWRT with ChilliSpot firmware, FreeRadius and LAMP as a complete hotspot solution. However, ChilliSpot is abandoned by its author, people have to spent hours on this solution without any official help. Additionally, I think ChilliSpot is much suitable for the person who wants to build up a central radius server to control multiple access points. For a simple access point, usually the simplest way is find a online back-end service provider to help you on authorization and accounting issues. In case you just want a free access point to attractive more customers to your restaurant, NoCatSplash is good enough. Of course, you have to rewrite a better HTML page stored on external web server. The default web page is too simple to attractive your potential customers, it has only a login button.
Reference
Linksys WRT54G series - Wikipedia
http://en.wikipedia.org/wiki/Linksys_WRT54G_series
OpenWRT - Wikipedia
http://en.wikipedia.org/wiki/OpenWRT
OpenWRT.org
http://www.openwrt.org/
Hardware-Specific Information for DD-WRT installation
http://www.dd-wrt.com/wiki/index.php/Installation
DD-WRT for WRT54G/GL/GS/GX
http://www.dd-wrt.com/wiki/index.php/Linksys_WRT54G/GL/GS/GX
Development and Customization for DD-WRT
http://www.dd-wrt.com/wiki/index.php/Development
Harware DIY for DD-WRT
http://www.dd-wrt.com/wiki/index.php/Hardware_DIY
- allankliu's blog
- 2114 reads





Post new comment