Raspberry Pi Weekend project
So finally took the time to try out a Raspberry Pi. For this weekend project wanted to do something relatively simple. Essentially, I wanted to recreate/enhance the functionality of a TL-WR702N.
The TL-WR702N Nano Router is a neat device but being closed, can not be customized to what I wanted. It can be used in the following modes:
- AP
- Client
- Repeater
- Router
- Bridge
Specifically I was interested in the bridge mode. However, rather than bridging from one SSID to another SSID, I wanted to route/nat between the two. So in theory, should be simple to implement (as the hardware should have all the necessary components) but not allowed by the software.
Enter the Raspberry Pi.
So the Pi, is a mini computer that can be loaded with any software you want. The B-model, has a built-in Ethernet and USB ports to plug-in two WIFI adaptors. For this functionality I am using the following:
- Raspberry-Pi Model-B
- WIFI stick (2 units)
For the software I am using:
- Raspberry Pi buildroot
- hostapd-rtl8192cu from Realtek You need to get the RTL8188CUS package for Linux.
So you need two WIFI adaptors, as one will not work as master and slave at the same time. Essentially, one WIFI interface will act as the client WIFI station. The other WIFI interface acts as a WIFI hotspot. I chose to use buildroot
instead of a normal Linux distro like Raspbian or Arch Linux Arm because I wanted to run it as an embedded system. Normal Linux distro's are supposed to be properly shutdown and would complain when you simply yank the power cord. The buildroot
image I have is customized so that the file system is always mounted read-only. It will switch to read-write only to write persistent data and then switch back to read-only. The normal hostapd
that comes with buildroot
is the normal open source project and does not come with the rtl8192cu
driver. You need to download and build the Realtek
version. For this to work, I did the following:
-
Create a start-up scripts that set the whole thing up.
- sets-up the filesystem
- starts
syslog
,sshd
,rngd
- sets-up
eth0
andwlan0
to be configured byifplugd
- starts
wpa_supplicant
onwlan0
- starts
httpd
- start and configure
wlan1
as an Access Point. - start and configure
dnsmasq
for DNS and DHCP.
- Wrote a small web UI to configure the WIFI client.
All this stuff can be found in github.