[RPi] Setup wireless access point using Nano USB adapter

As HifiBerry DAC+ replace USB DAC, there are some free USB ports to leverage. The USB ports can now used for both USB disk devices and USB wireless adapter for access point. I have found TP-LINK TL-WN725N small enough to put in RPi box. And in the web, there are a lot of successful stories but it requires some procedures to enable it as an access point. Below I put together another short guide. As an overview, you need to:

  1. Install firmware
  2. Replace hostapd
  3. Configure wireless interface

*** Note: This guide is only tested with TP-LINK TL-WN725N Nano USB adapter which uses r8188eu chipset and official RPi kernel. While it should work for 8188 compatible devices and may be 8192 chipset, but your mileage may vary. ***

Install firmware

Download and install realtek firmware. Please note wheezy package is too old to support 8188eu, so we download from wheezy backport:

wget http://ftp.jp.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-realtek_0.43~bpo70+1_all.deb
dpkg -i firmware-realtek_0.43~bpo70+1_all.deb

Then we now insert TL-WN725N wireless USB adaptor to the USB port, in dmesg, it should show:

[87558.337934] usb 1-1.5: new high-speed USB device number 4 using dwc_otg
[87558.458690] usb 1-1.5: New USB device found, idVendor=0bda, idProduct=8179
[87558.465664] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87558.473101] usb 1-1.5: Product: 802.11n NIC
[87558.477358] usb 1-1.5: Manufacturer: Realtek
[87558.481715] usb 1-1.5: SerialNumber: 00E04C0001
[87558.554269] r8188eu: module is from the staging directory, the quality is unknown, you have been warned.
[87558.570727] Chip Version Info: CHIP_8188E_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0)
[87558.611000] usbcore: registered new interface driver r8188eu

Replace hostapd

The wheezy hostapd is not compatible with TL-WN725N, but realtek provided a special mod. We download the binary from here. Then, backup original hostapd and replace with the new one:

wget http://dl.dropbox.com/u/1663660/hostapd/hostapd.zip
apt-get update
apt-get install unzip
unzip hostapd.zip
chmod +x hostapd
mv /usr/sbin/hostapd /usr/sbin/hostapd.orig
cp -rp hostapd /usr/sbin/hostapd 

Configure wireless interface

In /etc/network/interfaces, configure as wireless interface IP for access point. DHCP lease is offered by dnsmasq which is enabled by default.

auto wlan0
iface wlan0 inet static
        hostapd /etc/hostapd/hostapd.wlan0.conf
        up nat.sh wlan0 eth0 ""

In /etc/hostapd/hostapd.wlan0.conf, change driver to rtl871xdrv


Make sure you also change the SSID and wpa_passphrase, and enable 11n:


Then restart wlan0 interface by:

ifup wlan0

Running iwconfig and ifconfig you can see you access point is now ready!

root@voyage-mubox:~# ifconfig wlan0 ; iwconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 30:b5:c2:19:3a:99
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::32b5:c2ff:fe19:3a99/64 Scope:Link
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:116 (116.0 B)

wlan0     IEEE 802.11bgn  ESSID:"voyage-mubox-rpi"  Nickname:""
          Mode:Master  Frequency:2.437 GHz  Access Point: 30:B5:C2:19:3A:99
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0