Raspberry Pi Wireless Access Point with USB Edimax Adapter

May 17, 2015

I've used this little Wi-Fi adapter with great success with the Raspberry Pi without needing a powered USB hub. It turns out, if you want to flip this around and setup an access point things get a bit more complicated if you're not using any official Linux distribution.

First of all, there is a non-mainlined kernel patch (i.e. major copy and paste hack) that includes a more complete kernel driver for this chip. This patch has made it into a lot of distributed kernels, including the official Raspberry Pi kernel. However, if you're not using one of those kernels, you'll have to work this patch in yourself. By work it in, I mean there are some hardcoded values and architecture settings in the driver you might need to change.

The following commit is the one I am referring to found on the rpi-4.0.y branch of git://github.com/raspberrypi/linux.git

commit a5a840d5e0609ec037dfe2d3ad55f6f78e7efa5e
Author: popcornmix <popcornmix@gmail.com>
Date:   Mon Sep 3 17:10:23 2012 +0100
 
    Add non-mainline source for rtl8192cu wireless driver version v4.0.2_9000 as this is widely used. Disabled older r
 
    8192cu needs old wireless extensions
 
    The obsolete WIRELESS_EXT configuration is used
    by the old Realtek code and is needed for AP support.
 
    8192cu: CONFIG_AP_MODE hardcoded in autoconf.h

Once you have the driver, now the userspace daemon hostapd needs support for it (rtl871xdrv). The original changes I ran across for this are here. That repository also talks about the kernel drivers being maintained here. In any event, the hostapd changes are not exactly in the form of a ready-to-go patch. I've converted it to a patch and added it to my buildroot branch located here.

When you've got all that ironed out, here's an example /etc/hostapd.conf for an open access point. I'll leave setting up wpa_supplicant to the reader for properly securing and also setting up the bridge and NAT for a true access point.

interface=wlan0
driver=rtl871xdrv
ssid=rpi-ap
channel=1
wmm_enabled=0
macaddr_acl=0

From there, you should be able to go live with something like the following:

modprobe 8192cu
ifconfig wlan0 192.168.8.1 netmask 255.255.255.0
hostapd -dd /etc/hostapd/hostapd.conf

You can read more about what I ran across uncovering how to get this to work here and here, but be warned that they don't get into the nuts and bolts of what you really need and they link to very old binaries of hostapd.

Related Posts