Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL8188CUS chipset)

I’m writing this blog to help anyone with an Edimax Nano USB WiFi adapter (EW-7811Un) configure a Wireless Accesss Point. The main reason I wrote this post is because the Edimax was the first wireless adapter I ever recommended(turning a Raspberry Pi into a fully functional web server). I chose this adapter because it works out of the box, is cheap, and has a really low profile. But when I started the process of trying to turn my rPi into a WiFi hotspot, it seemed that every tutorial out there claimed that the Edimax card I had recommended “doesn’t support Access Point”.

Luckily for you and me, this is not the case.

edimax-dime-ss

Given the varied level of experience of my readers, this tutorial will start from scratch. If you already have your operating system running, skip forward as needed.

For this tutorial I am using Raspbian. I recommend it because it is an optimized version of Debian built specifically for Raspberry Pi’s. The last stable downloads can be found here.

To flash your SD Card, you will need to unzip the image and write it your SD card using Win32DiskImager. This tool can also be used to after our initial setup to create an image of our finalized implementation(very useful as a backup).

windiskimager

After the image is flashed, you can boot your device. At this point you can use your HDMI Cable/Mouse/Keyboard for your initial configuration, or you can use an SSH Client like Putty to connect. The default hostname, login, and password are as follows:

host:raspberrypi
Username: pi
Password: raspberry

raspberry pi putty

For this tutorial, I will be using putty. On first boot, you will be prompted with a configuration tool called Raspi-Config. If the raspi-config doesnt load automatically, just enter the following command from the shell to get started.

sudo raspi-config

raspi-config-screenshot

The settings I recommend you update are

update
expand_rootfs
change_pass
change_timezone
memory_split

The usual distribution images are 2 GB. When you copy the image to a larger SD card you have a portion of that card unused. expand_rootfs expands the initial image to expand to fill the rest of the SD card, giving you more space. By default, 64mb is reserved for the Graphical UI. Since we plan on using this as a WiFi Hotspot, we can reduce this to 32mb with the memory_split command.

After you finish your changes to the raspi-config, you should reboot your pi using the following command:

sudo shutdown -r now

At this point you have a fully functional linux server, but we still need to check our network card and setup our WiFi hotspot.

Prerequisites

The first thing you need to do is make sure you have an existing wired connection to your rPi. After that, you need to install the following packages.

sudo apt-get install bridge-utils hostapd

The whole crux of the issue is that it is the apt hosted copy of hostapd that is not compatible with the RTL8188CUS chipset. But, thanks to the Edimax team, I’ve got a replacement hostapd binary to resolve this issue. This tutorial will not work without it.

To download and replace the installed binary version of hostapd we just installed, issue the following commands:

wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip
unzip hostapd.zip 
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv hostapd /usr/sbin/hostapd.edimax 
sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd 
sudo chown root.root /usr/sbin/hostapd 
sudo chmod 755 /usr/sbin/hostapd

*Note, some people don’t like the idea of installing from untrusted 3rd parties, so if If would rather compile your own binary, you can download the realtek driver here . You will have to navigate to the ~/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/hostapd and run a make, make install, then hostapd like i did above.

Bridge the Network Connections

Now that we have the proper hostapd installed, we need to create a bridge between our ethernet connection and our Edimax Wireless card. To do this, we need to edit our network interfaces:

sudo nano /etc/network/interfaces

To avoid any conflicts, you need to delete or comment out(#) any lines conatining wlan0 and then add the following text to bridge the connections, assuming your ethernet and wireless adapters are named eth0 and wlan0( use ifconfig -a to check)

auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

The resulting file should look like this:

#loopback adapter
auto lo
iface lo inet loopback

#wired adapter
iface eth0 inet dhcp

#bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

Configuring Hostapd

Now that our interfaces are setup, we need to configure hostapd. To do so, create the following file

sudo nano /etc/hostapd/hostapd.conf

with the following contents:

interface=wlan0
driver=rtl871xdrv
bridge=br0
ssid=DaveConroyPi
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=ConroyPi
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

Wrapping Up

We should be finished now, and afer a reboot

sudo reboot

you can test your configuration using the following command

sudo hostapd -dd /etc/hostapd/hostapd.conf

If it runs as expected, you can add it to startup by editing

sudo nano /etc/default/hostapd

and uncommenting and updating the following line

DAEMON_CONF="/etc/hostapd/hostapd.conf"

That should do it! I’m happy to answer any questions, just comment on this post. Thanks for reading!Raspberry Pi as WiFi Hotspot

213 comments

  1. Mohammed

    Hey Dave thanks for this awesome tutorial, but when I try to connect to the new access point, it keeps telling me that an authentication error has occurred and it does not connect. What is going on?

    • dconroy

      Have you made any changes to the hostapd.conf? Are you bridging the connections?

      • Jack Barnhart

        Hey dave I can not find the Edimax anywhere, but I bought a G54/N150 Wifi USB Micro Adapter. It is made by NetGear. Will this still work?

    • Mohammed

      never mind.. a reboot fixed the issue

    • Is there any way to have it use WEP or no encryption? I’m trying to set this up as a hotspot for my DS.

    • Dennis Eckert

      Hello sir,

      Did you change the address as —

      http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip returns bash error of no such file or directory. I did have a wget in front of it but I’m missing something about how to type in this e-mail form. I tried to paste into it netsurfer browser but won’t support pasteing. lsusb reports my adapter (opurchased from AdaFruit) as 0bda:8176 and RTL8188CUS.
      Re getting the zip file, I first pasted from your wev site the download link and it did not work. then I handtyped it in and still reports no such file or directory.

      • It looks like you left off the “wget”.

        Don’t use a browser.

        Run the command beginning with “wget” on your Pi

  2. Dave you did an awesome development job! I’ve been struggling with getting PiUi up and running, because of the the Realtek WiFi chip compatibility challenge. Tried several versions of the web server with no luck, but yours ran first time! Nice job implementing the Realtek drivers properly.

    And PiUi runs flawlesly on top of your server. If you haven’t, you should check it out. A great way to set up platform-independent remote application control.

    • dconroy

      I hadnt heard of it, thanks. I’ll check it out. Glad my post could help you…

      Dave

    • dconroy

      Finally got around to running PiUi, what a great little script. Now my mind is really racing, thanks!

  3. I tried this and I got an initialization error on the driver. It stated the following:
    “Could not set interface wlan0 flags: Operation not permitted.”
    I am running as root so this shouldn’t be a permissions problem 😛

  4. The exact error I’m getting is this:

    root@raspberrypi:~# hostapd /etc/hostapd/hostapd.conf
    Configuration file: /etc/hostapd/hostapd.conf
    Could not set interface wlan0 flags: Operation not permitted
    drv->ifindex=3
    l2_sock_recv==l2_sock_xmit=0x0x4db638
    ioctl[SIOCSIWMODE]: Operation not permitted
    Could not set interface to mode(3)!
    Could not set interface to master mode!
    rtl871xdrv driver initialization failed.

    • dconroy

      Can you check to see if your wireless card is interface wlan0 by running the command ifconfig?

    • What version of hostapd are you using? For RTL8188CUS chipset you need the exact version of hostapd like mentioned in this article with the download link as the standalone hostapd does not support master mode on this chipset however the chipset has this mode.

      Michal

  5. Hi Dave, thanks for the great guide. I’m using the edimax and pi as a stand alone AP for my van so no need for the bridge.

    Everything works great but the AP is only working in 802.11b mode. When I specify hw_mode=n or g, hostapd won’t start so I’m guessing it’s the new driver? Any ideas?

    • dconroy

      can you post your hostapd.conf?

    • dconroy

      Do you get any error messages? Could be extraneous white spaces?

      • At work, but a quick update… hw_mode=g works now, when i specify hw_mode=n, it does spit out an error about “n” not being valid, can’t remember the exact error.

        I used your hostapd.conf from above with different SSID and pw. The only other change I made was to comment out the br0 line since I’m not using bridging, just stand alone AP.

        • dconroy

          try adding the line

          ieee80211n=1

          • I’ll try that out, thanks!

          • I have exactly the same issue! Adding the IEEE80211n=1 lne did not work for me…can anyone confirm that they actually get n speeds?

          • set a # before hardwaremode=n and enter ieee80211n=1 instead

  6. got your link from a raspberrypi forum user. after trying the adafruit tutorial and a few diff hostapd versions, bingo! your tutorial had my Pi bridging in less than 30min. i was only needing a bridge AP anyways for my home net.

    i’m using the LB-Link USB adapter, model BL-LW05-AR5. ‘lsusb’ lists the driver as Realtek RTL8188CUS, in case any other users find that helpful.

    appreciate your tutorial!!!

    • dconroy

      Glad the tutorial could help, I spent days trying to get it work the first time around! And thanks for the tip.

  7. Thx a lot saved me from buying a new wifi-adapter.
    Nice Tutorial, works fine, pretty good work.

    Thanks!

  8. Kartik

    This worked as long as my Pi was connected to the router which provided DHCP services. However, If I connected the router directly to the modem (Time Warner), this procedure would not work. I followed the instructions in this page and used the hostapd application and the hostapd.conf from here. I did not bridge network interfaces and used udhcpd and iptables.

  9. Hi there, I was wondering if all of this is isolated to the operating system that it’s configured on? I have a spare 4GB SD card and I don’t want to change the settings I have on my primary Raspbian SD card. If I made the 4GB card primarily a Hotspot card, that won’t affect how my 32GB Raspbian card deals with RAM and wifi, will it?

    • dconroy

      Hello Nick,you are correct it is isolated to the card.

      You could install this on your 4gb card and just swap it in and out with your 32gb card as neeeded.

      Or, you could always buy another Pi! I’ve got 6 now!

      • Hey, I finally got my pi out to try this out. However, the first time I tried connecting, my device (an Android phone) was stuck on authenticating and eventually ignored the network due to ‘poor connection’. I turned on DLNA auto-ip and was able to connect, but that assigned a 169.254 address to my phone, whereas all other devices including the pi have 192.168 addresses. None of my internet applications work, although it says I’m connected with full bars. Any idea what the problem could be?

        • 169.154 means you aren’t getting an ip. See if setting up on any connected device works. If so, make sure your DNS is working on the pi or whatever device that is providing your pi Internet

          Thanks

          • DNS is working on the router, and I tried a few different devices, all of them have the same problem. My hostapd.conf is identical to yours, minus a change in password and network name. I also tried changing the channel, but to no avail.

  10. Does anyone know what sort of range you get with this wifi? Could users in the floors above still get a decent signal or do you need to be pretty close to to Pi to get a strong signal?

    thanks in advance

    • dconroy

      I as able to get strong signal in my basement with this running in my kitchen directly above me. I wouldnt push it further than that. If you want a better range, I’d suggest getting a wireless card with an antenna and using a powered USB hub.

      • Richard Wenner

        A cheap passive option is to place the WiFi device at the focus of a microwave dish – either directly or using a very short cable.

  11. Dave,
    It worked like a charm. I am using a USB WiFi model Belkin Surf N150 and I needed desperately an AP based on the Raspberry.
    Thank you for the _great_ tutorial.

    Tiberio

  12. Hi Dave thanks for the tutorial , very good job . In my Raspberry it works fine as Wifi Hotspot , the only issue I have is that the board now doesn’t responde at ping command and also ssh is not responding , bat the Hotspot works fine , remote client can connect to internet.
    How is it possible this issue ?
    Thanks in advance.

    Mario

  13. Great work and write up! Works flawlessly on the first try. I’m using an Edimax 7612UAn V2, but I believe it has the same chip as the 7811Un. Anyway wholeheartedly recommended, only the range could be somewhat better, even with the antenna of the 7612UAn and using a powered USB hub, but for my purpose I can’t complain. Thank you Dave!

  14. Ulrich Baustian

    The signal quality is excellent, but it accepts neither the password I have given the raspberry, nor the password of my router. Any recommendations?

    • Ulrich Baustian

      I have found the password in your hostapd.conf:

      wpa_passphrase=ConroyPi

      Now everything works fine.

  15. malcolm dick

    Worked great for me. Thank you very much.

    Question: Would it be possible to use 2 edimax USB dongles – one as an AP and the other to connect to a WiFi hotspot?
    The reason this would be handy is when I travel with a group, we have many devices to connect but many Hotspot services and Hotel wifi limit the number of devices you can connect to 1.

    • Chris Thomas

      I’d also be interested in doing the same thing!

      • malcolm dick

        Hey I had a play and got this going!
        What I did was:
        – Plugged both Edimaxes into the 2 USB ports on the Pi
        – Configured the Pi for medium overclocking in the Noobs setup (Raspbian). It didn’t work without this

        – Changed /etc/network/interfaces to include this

        bridge_ports wlan1 wlan0 #changed eth0 to wlan1
        allow-hotplug wlan1
        auto wlan1
        iface wlan1 inet dhcp
        wireless-essid xxxxxx #the public AP

        – Added the DHCP setup as per Dave’e earlier link

        Only bummer is having to change the essid when you move to a different hotspot. Probably needs a little web page to do this for you.

        • I am experiencing an issue where I have both wifi adapters running on boot, one of them hosting the access point and the other successfully connecting to my router. Whenever I try to access the AP at that time the connection to my router drops and I can access the local webserver only. Could you please give some advice on why wlan1 stops working after a connection to wlan0? Here is my interfaces file:

          auto lo

          iface lo inet loopback
          iface eth0 inet dhcp

          allow-hotplug wlan0
          iface wlan0 inet static
          address 10.10.0.1
          netmask 255.255.255.0

          bridge_ports wlan1 wlan0

          allow-hotplug wlan1
          auto wlan1
          iface wlan1 inet manual
          wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
          iface default inet dhcp

          • If I ssh the Pi from the access point and type wpi_cli reconnect it auto selects wlan1 and connects it back to the internet. Is there a reason that it auto disconnects when I connect to wlan0 from any device?

          • You don’t need two dongles. The same dongle can be client and AP at the same time. I might be mistaken but I’ve seen tutorial about
            “repeating” the signal.

  16. This tutorial is a good starting point! Unfortunately, the hosted.conf file leaves the Edimax adapter running at the slowest possible speed. In order to get the full 150Mbps performance, I added the following to hostapd.conf:

    hw_mode=g
    wmm_enabled=1
    ieee80211n=1
    ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40][SHORT-GI-20][MAX-AMSDU-7935]

    Depending on your channel, you might need to use [HT40-] rather than [HT-40+]. Now when I run ‘iwconfig’ it shows me that the bit rate is 150Mb/s rather than 11Mb/s.

    FWIW, I tried a bunch of the other ht_capab options and found that the following DO NOT work with the EW-7811Un: [RX-STBC*], [DELAYED_BA], [SMPS-*], [GF].

    • Hi ScottS,

      i also have the performance problem.
      So i have added your suggestion to the hostapd.conf but the best connection i get is 54Mbps

      Can you give me a hint?

  17. MagicPi

    Hi Dave,
    thanks for this great Tutorial, but how can I disable the bridging?
    Thanks.

  18. Jack Saunders

    Hi, i have set this up and its working great, i also have set up a VPN tunnel using openvpn, what’s a simple way to use that internet connection with the wireless access point?

    thanks
    Jack

  19. Hello Dave,

    thank you very much for that cool description. It works well with ethernet to wlan adapter.
    My qustion is, is it possible to make a oure WiFi hotspot? Do I need two wlan adapters or is it possible with just one wlan adapter and what do I have to change in the configurazions?

    Thank you very much in advance.

    With kind regards

    Eddi

  20. Rob Steenvoorde

    Thanks for the tutorial, it’s working perfectly!

  21. Scott Stephan

    Hey Dave!,

    Great tutorial, but I’m bumping into what feels like a simple error. WHen I try to run the hostapd.conf, I get this error: “invalid/unknown driver ‘rt1871xdrv”.

    I’ve run through the whole install off your website twice now and still getting the error- Any idea where I might have mucked it up? I didn’t get any errors during the process

    • dconroy

      Hello Scott, before we debug any further, are you sure your wifi card has the RTL8188CUS chipset? This is a very specific tutorial for that hardware

    • Virgilol

      Scott: Edit your hostadp.conf, in driver=rtl871xdrv, it’s not rt1, it’s rtl. A “l” (letter), not a “one”.

      • Trav Easton

        Thank you very much. This was the exact error I was having, I even checked it twice and didn’t pick up my one/L mistake.

      • olddosman

        Well spotted Virgilol! I had the same typo. Excellent tutorial Dave – now my Pi will be appreciated by the family when we visit wifi less relatives at Xmas!

  22. Hi! Great tutorial! But if I want to use the wifi dongle only as Hotspot with a dchp server and not with the bridge option? I would use it on my car and I haven’t the lan plugged into
    Thanks

  23. Hi Dave. Greate tutorial. Would this also work on a normal Debian. With the driver solution?

  24. Hey Dave,

    Great little tutorial. I’m getting the following error though:
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    Could not read interface flags: No such device
    ioctl(SIOCGIFINDEX): No such device
    rtl871xdrv driver initialization failed.

    I’ve tested the edimax in other Windows machines and it does work but it doesn’t look like its been recognized here. I’m pretty new when it comes to linux – any suggestions? PS I’m using the Shairport raspberry pi image from here as my base:

    http://snippets.khromov.se/preconfigured-airplay-speaker-shairport-downloadable-raspberry-pi-image/

  25. Hi. This post is great, but I am reaching my point of frustration. Let me start by saying that I tried the standard hostapd package, and making/compiling my own realtek drivers, and third try is using your package. My problem is always the same: I get the proper hostapd.conf file, i’m not bridging interfaces but rather using a dhcp server listening on wlan0, and I am able to start hostapd with hostapd -dd /etc/hostapd/hostapd.conf.
    Furthermore, the SSID is broadcasted and I can see it with my cellphone, laptop, kindle fire, you name it.

    I’ve tried many clients and they simply can’t connect…. the client hangs there for a bit, tries to connect, and times out. Some call it an “authentication error”. Needless to say, I’ve tried with WPA2, WPA, and even none (I actually want it Open).
    My hostapd.conf is as simple as:
    [root@pi ~]# more /etc/hostapd/hostapd-mini.conf
    interface=wlan0
    driver=rtl871xdrv
    ssid=spot-wifi-min
    #hw_mode=g
    channel=11

    The -dd option is not showing me anything other than:
    wlan0: Setup of interface done.
    Wireless event: cmd=0x8b15 len=20
    Wireless event: cmd=0x8b15 len=20
    Wireless event: cmd=0x8b19 len=8

    And I have no clue what those are….

    Any help is greatly appreciated…. I feel like I am so close to it.

    • I am having this exact same problem. Trying to connect with wpa_supplicant leaves it in a loop of ‘Trying to associate’ and ‘Authentication timed out’.

      Doing iwlist wlan0 scan on another machine shows the access point information all looks sane (i.e. no different than any other wpa access point)

      dmesg shows no errors. I get a similar output from hostapd.

      I am also not using a bridge, and have dnsmasq listening on wlan0. Ill check to make sure there isnt some bug requiring it to need a bridge interface, but Im almost certain that wont work.

      • Can I confirm that you’re using kernel 3.6.11+?

        I tried the rtl_hostapd_2G.conf from the realtek package (which looks like it hasnt been updated since kernel 3.0.8?) and same problem, no dice.

        I ran strace on hostapd and it looks like it goes into a loop of timeouts waiting for data from something. lsof|grep hostapd doesnt say anything that helps me.

        strace output snip:
        select(8, [5 6 7], [], [], {0, 0}) = 0 (Timeout)
        gettimeofday({1377978723, 891003}, NULL) = 0
        gettimeofday({1377978723, 893062}, NULL) = 0
        gettimeofday({1377978723, 894911}, NULL) = 0
        select(8, [5 6 7], [], [], {9, 989530}) = 0 (Timeout)
        gettimeofday({1377978733, 897005}, NULL) = 0
        gettimeofday({1377978733, 897304}, NULL) = 0
        gettimeofday({1377978733, 897615}, NULL) = 0
        gettimeofday({1377978733, 897902}, NULL) = 0

        • dconroy

          Yes to 3.6.11+

          • It was my fault. I skipped the part about bridging, which had the bit about removing /etc/network/interfaces entries. wpa_cli on the pi was fighting with hostapd. I can almost guarantee thats the problem with the previous poster.

            I did however find this in my digging:
            http://www.raspberrypi.org/phpBB3/viewtopic.php?t=24951
            and was able to get the standard hostapd working in at least open mode by replacing the kernel modules shipped with rasperian with standard ones.

            Thanks again for the tutorial, and good luck to everyone else.

          • Bill, I’m glad you got it working. I try to keep up with the comments, but this blog post alone has 60!

            Thanks for sharing your fix as well.

  26. Charles Krinke

    Dear Dave:

    I wonder if you could expand on compiling the special hostapd and the changes Realtek made to this package. I am working on a powerpc project using the Edimax EW-7811Un as opposed to my Raspi right now and need to understand the cross-compilation a bit.

    I normally expect to define ARCH=powerpc & CROSS_COMPILE=powerpc-linux-gnu- and move forward, but this Makefile does not respond to CROSS_COMPILE or ARCH.

    I am hoping you can help me gain understanding of how to use this Makefile to compile a powerpc binary and possibly what some of the changes made by Realtek to hostapd and wpa_supplicant are.

    Thank you kindly, Charles

  27. jyoung383

    Thanks Dave! this has got me connecting to my pi very easily. I have 1 modification i would like to make and after days I am still stuck. I want to be able to connect to my pi hotspot without the pi being connected to the internet with an ethernet cable. whenever I try to connect with no cable attached it wont connect. I don’t need passthrough. basically I have webiopi running on the pi and want to connect to that server wirelessly, no internet access is needed. thanks for any help you might have.

    • If you just want an access point without a bridge, after following Dave’s instructions, the /etc/network/interfaces file can be changed to something like:

      auto lo

      iface lo inet loopback
      iface eth0 inet dhcp

      allow-hotplug wlan0

      iface wlan0 inet static
      address 192.168.20.1
      netmask 255.255.255.0

      This works for me. In my case I also setup raspbian with a DHCP server by installing udhcpd, so clients use this to get an address, but I think static addresses for clients will also work.

  28. GREAT JOB!!! THANKS A LOT for this tutorial man, know I’m navigating througth r-pi. I’ve been tried to make this for a few days without success because the way to make the brigde doesn’t worked correctly. With your infromation about this I can make it works!!!
    I Created an open wireless network so I commented the lines about WPA encription and I used a diferent wireless adapter with a rt5370 driver, to make a the configuration in order to work this adapter I changed the driver line in hostapd.conf too by the next line:
    driver=nl80211

    I have a question: I need to install something more to make a hotspot captive portal but when I tried to ping something the response is:
    ping: unknown host xxx.xxxxxxx.xxx

    So do you have any sugestions?

    Great & Thanks again dude!!!!
    Grettings from Mexico!!! :p

  29. Thanks for writing this up so clearly.

  30. So when I go to test using the command sudo hostapd -dd /… My pi will launch into the whole thing

    rtl871x_set_key_ops
    Using interface wlan0 with hwaddr 80:1f:02:7e:6f:ab and ssid 'Win32BlasterWorm'
    Deriving WPA PSK based on passphrase
    SSID - hexdump_ascii(len=16):
    57 69 6e 33 32 42 6c 61 73 74 65 72 57 6f 72 6d Win32BlasterWorm
    PSK (ASCII passphrase) - hexdump_ascii(len=12): [REMOVED]
    PSK (from passphrase) - hexdump(len=32): [REMOVED]
    rtl871x_set_wps_assoc_resp_ie
    rtl871x_set_wps_beacon_ie
    rtl871x_set_wps_probe_resp_ie
    random: Got 20/20 bytes from /dev/random
    Get randomness: len=32 entropy=0
    GMK - hexdump(len=32): [REMOVED]
    Get randomness: len=32 entropy=0
    Key Counter - hexdump(len=32): [REMOVED]
    WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK - hexdump(len=32): [REMOVED]
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid_ops
    wlan0: Setup of interface done.
    Wireless event: cmd=0x8b06 len=8
    Wireless event: cmd=0x8b15 len=20
    wlan0: WPA rekeying GTK
    WPA: group state machine entering state SETKEYS (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK - hexdump(len=32): [REMOVED]
    wpa_group_setkeys: GKeyDoneStations=0

    and then it enters this loop that says

    rtl871x_set_key_ops
    wlan0: WPA rekeying GTK
    WPA: group state machine entering state SETKEYS (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK - hexdump(len=32): [REMOVED]
    wpa_group_setkeys: GKeyDoneStations=0
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    rtl871x_set_key_ops

    and it will just repeat through this loop over and over, any suggestions on were to look? I’ve tried reading through the comments to see if anybody was having a similar problem but it appeared that nobody was, (I could be wrong)

    there is a lot more above what I gave, but most of that seemed ok, I noticed it said something about wireless event and then gave some kind of number but I couldn’t find anything that was much help on what those numbers mean

    any help to get me going in the right direction would be greatly appreciated

  31. Have you ever used hostapd with open ports? I am trying to use it on a pi to make a portable server that i can use to move files between two computers for a club project.

    Thanks for any help.

    Great tutorial by the way, worked perfectly.

  32. Made my day! …or Night.
    Perfekt for me to take one pi to my working place.
    Thanks a lot!

  33. Hi Dave,

    does this also work with raspbmc?

    Thanks to you!

  34. Dave or anyone else who may know – if I used this solution as a wireless repeater like someone suggested by using two WiFi dongles, do you know if I can broadcast a SSID same as what I’m consuming or connecting to, ie my primary router’s SSID would it work OK, like other wireless repeaters do with two physical adapters or one virtual and one physical like dd-wrt?

    thanks!

  35. Hi Dave,

    I am using a recent release of raspbmc, which is based on Raspbian, but possibly there are some differences that stops this working for me…

    The first thing was that I found the original /etc/network/interfaces was empty, although it did exist.

    When I make this file look exactly as you mention above (starting “#loopback adapter” and ending “bridge_ports eth0 wlan0”), on reboot, eth0 does not come up. Same result with just the three lines in the box right above the full version.

    I can issue “sudo ifup eth0” though, and my eth0 network comes back up, and gets its IP address from a DHCP server.

    I tried adding “auto eth0” to the file, but that doesn’t make it work at boot either! Only if I set the file back to being empty does it seem to start the eth0 network on boot.

    Since the “interfaces” file is empty, there must be some configuration elsewhere…

    It looks like the config is in /etc/NetworkManager/… since I found some relevant config files there and since https://wiki.debian.org/NetworkManager mentions some interaction information about the “interfaces” file.

    The “sudo hostapd -dd /etc/hostapd/hostapd.conf” step showed some signs of life (AP was visible but immediately disconnected), but I need a system with a working network at boot before I can make any permanent changes.

    Do you think it is “NetworkManager” that is causing this, and do you have any suggestions on how to get it working? (My config is nothing unusual; it is just eth0=wired Ethernet and wlan0=Edimax EW-7811Un USB dongle).

    Thanks,
    Tim.

    • Hi Tim,
      I’m trying to do the exact same thing with the same components and raspbmc. If you found a solution, can you share it?
      Thanks,
      Peter

      • Sure. I did a bit of digging:-

        * raspbmc does use NetworkManager [http://forum.stmlabs.com/showthread.php?tid=5495].
        * NetworkManager will not manage any interface mentioned in /etc/network/interfaces [https://wiki.debian.org/NetworkManager], although if you set “managed=true in /etc/NetworkManager/NetworkManager.conf”, it will “handle” that interface [https://wiki.debian.org/NetworkManager] (not sure what “handle” means exactly).
        * It’s possible/likely that eth0 was not coming up because mentioning it in /etc/network/interfaces meant that NetworkManager stopped handling it, as a result.
        * NetworkManager had support for “AP-mode Hotspot” added in version 0.98, released in February 2013 [https://projects.gnome.org/NetworkManager].
        * raspbmc network settings are configured using the XBMC UI and are stored in /home/pi/.xbmc/userdata/addon_data/script.raspbmc.settings/settings.xml [http://forum.stmlabs.com/showthread.php?tid=1792].
        * It looks like those settings.xml are used to update the NetworkManager configuration and there is a rasbpmc script to set up networking (so possibly it is responsible for updating the NetworkManager configuration) and the following will list the available options when run as user pi: “python /scripts/nm-update-network.py -h” [http://forum.stmlabs.com/showthread.php?tid=5495].

        One possible strategy would be to look into the support for bridging networks that was added to NetworkManager and extend the nm-update-network.py script to add the extra options.

        It’s unlikely I’ll get time to do this myself. Anyone brave enough and who finds the above helpful, please add a comment here with further info – thanks!

        Tim.

  36. Christian

    Hello,
    it works fine. But what i have to do to make it undo.
    At the Moment i can start the AP, but after a reboot i am not able to connect to my ohter AP. My Wlan device is not present…

    please help !!!

  37. Great job, Dave!
    And the tutorial is perfect.
    Thanks a lot !

  38. Hi Dave,

    I have an Alfa 1 card for wifi, how do I know what’s the right driver that I need to add in hostapd.conf?

    Thanks!

  39. Hi Dave and greetings from France.
    Thx a lot for your hostapd file for the Edimax Usb wifi key.
    I wanted to make the onion router prject as described in the last “Linux & Dev mag” and of course had the problem when I tried to start the hostapd service.
    But I still wonder why we had this problem with the Edimax Stick. The tuto was based on a usb wifi key sold by adafruit. I checked the chip and the Edimax seemed to use the same. So bought it at Amazon (sending costs from UK were too expensive for the adafruit model). I could have bought a usb wifi adapter by PI HUT at Amazon which was cheaper but some people said that the chip used was varying, so I didn’t want to take that risk.

    Anyway, your Hostapd solved my problem and I could connect to internet with a windows Phone and an Android device without any trouble.
    Second step will be to add the TOR 🙂

    Just a question. Is there a risk that a dist-upgrade could update or replace the current Hostapd file and break my “toy” by the same way ?

    Herve

  40. Hi Dave,

    the Edimax dongle always was my favorite wifi adapter, bad sadly it doesn’t work in wifi access point mode (I thought).
    Now I tested your replacement hostapd binary in my little robot project (PiBot-B). to my surprize: it works fine without the need to change anything else.

    Thanks a lot!

  41. hello,
    I have the WL-700-N usb wifi of Synalogic, and has the chip RTL8188CU …. is it the same chip as the RTL8188CUS? ….
    I do not run the drivers ….
    The problem:

    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    drv->ifindex=3
    Configure bridge br0 for EAPOL traffic.
    ioctl[SIOCSIWMODE]: Invalid argument
    Could not set interface to mode(3)!
    Could not set interface to master mode!
    rtl871xdrv driver initialization failed.

  42. Hello,
    it work fine, thanks Dave.
    is it possible to limit access to a single wireless connection?
    Thank you

  43. Larry Dighera

    Thank you very much for reccommending the Edimax EW-7811Un USB WiFi adapter for Linux networking. I’m running Arch Linux on a Raspberry Pi, and had been struggling to make a D-Link Nano DWA-131 A1 (and others: Edup EP-N5808, …) work reliably for months. Switching to the EW-7811Un enabled wireless connection pronto!

    Best regards,
    Larry

  44. Thank you so much , I try it for a long time with RTL8188CUS so now I can go to next step (Thank you so very much)

  45. Infinity580

    Hi,

    Your Tutorial dosent works, i have the same edimax w-lan stick but my netbook cant connect and i dont get a message or eror.

    • its probably the dns server. reboot the dns after hostapd starts and I bet you will connect.

  46. Dougie Lawson

    Thanks so much for this. I downloaded
    RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911 from the Realtek site, built the hostapd version in that package and it just works.

    I’m using a powerline for the ethernet but my new AP is running.

  47. TeaYoung Kwon

    Thank tutorial

    I want to use hostapd without eth0.
    So has the following changes.
    / etc / network / interfaces
    bridge_porots wlan0

    The connection. However, only the first few seconds of the connection.
    I isolated network between the two and I want to transfer files wirelessly.

    two isolated without eth0 in order to configure the network, what should I do?

    thank you

  48. Hello,
    I used Edimax EW-7811Un 802.11n. I could manage hostapd recompilation. Everything is OK. I’ve setup isc-dhcp-server as below

    # cat /etc/default/isc-dhcp-server
    INTERFACES="wlan0"

    and

    root@rpikhuong:~# cat /etc/dhcp/dhcpd.conf
    ddns-update-style none;
    authoritative;
    log-facility local7;
    default-lease-time 600;
    max-lease-time 7200;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.12.255;
    #option routers 192.168.10.1;
    #option domain-name "raspberrypi.com";

    subnet 192.168.12.0 netmask 255.255.255.0 {
    range 192.168.12.10 192.168.12.12;
    }

    when i tried to connect to the RPI access point from my android phone or my ubuntu by inputing the password above. But both devices can't receive IP address. It seems DHCP daemon couldn't provide IP address via wlan0 or I did somemissing.

    I've tried to use tcpdump on wlan0 of RPI but I didn't see any package sent from ubuntu machine/android phone.

    nm-tool on ubuntu machine represented as below


    - Device: eth1 [Pi_AP] --------------------------------------------------------
    Type: 802.11 WiFi
    Driver: wl
    State: connecting (configuring)
    Default: no
    HW Address: 70:F1:A1:DF:58:14

    Capabilities:

    Wireless Properties
    WEP Encryption: yes
    WPA Encryption: yes
    WPA2 Encryption: yes

    Please advise.

    Thanks,
    vominh

  49. Hi. Thank you for the tutorial. I am trying to set my eth0 connection with a fixed IP, but as soon as I do that, I lose the bridge. I no longer have access to the internet via my tablet. I changed the line

    iface eth0 inet dhcp

    with

    iface eth0 inet static
    address 192.168.0.199
    netmask 255.255.255.0

    It also happens as soon as I input:

    sudo ifconfig eth0 192.168.0.199

    Any hints? Does it need gateway information?

  50. Thanks you so much for your instructions.
    They worked out of the box.

  51. Hi! Thanks for the guide, very well written. After the reboot I can’t connect via ssh to my raspberry. (I use mobaxterm). Any ideas?

  52. Hi
    This tutorial seems simple and great, but it does not work with me �
    I explain : I bought this adapter on Adafruit with my Pi [http://tellu.re/HYTODq] and I’m trying to configure an AP but I can’t.
    I did everything but I don’t see my WiFi network on my mobile devices. Another thing is my Pi is connected through Ethernet to my box which is also on 192.168.0.x, how to change it ? Because I did all the steps but when I rebooted (at the end), the system said me his IP adresses were 192.168.0.3 (on the eth0) and 192.168.0.9 (on br0). While I was applying what was written, I could ping the Pi and control it via SSH from my laptop but now I can’t.
    Can you help me please ?
    Thanks

  53. hi.great tutorial.
    can you help me?

    i want to use the edimax as “access point”. no bridging. ethernet should will be use only to make some updates.
    only an ap to connect with my iphone and control some gpios over an php website.

    how i’ve change the sudo nano /etc/network/interfaces?

    • Hey need the same.

      No bridging, only AP to connect my mobile deviced to the web server running on my RPi.

      Is it enough NOT to install bridge-utils and NOT to add the bridging lines to config?

      Thx.

    • Francisco

      I need exact the same thing, do you know how to do it?

    • Thanks, Dave, for the great tutorial. I couldn’t get isc-dhcp-server to work, but with udhcpd I was able to establish a connection and get a lease with my Android (v.4.0.1) phone. I didn’t enable bridging, because I don’t believe I need it for what I’m trying to do (?)… which is: just connect to the Pi’s wifi with the phone and get the bash prompt. IOW, I want to ssh into the Pi with my phone… IOW use the phone as the screen, keyboard, and mouse for the Pi. Using the android app, JuiceSSH, I was able to get onto the Pi over the wired connection, but not via the Pi’s access point. Does anyone know what I’m missing?

      I think a few other people are trying to do pretty much the same thing.

      tia,
      ken

  54. Hi Dave,

    thank you very much for you good tutorial. After the setup of the WAP I have some trouble installing TOR on my Raspberry Pi.

    Could you please recommend any tutorial that explains how to setup TOR?

    What is particularly difficult for me is, I guess, this, because there is no IP number now:

    “wlan0 Link encap:Ethernet Hardware Adresse 44:33:4c:74:31:04
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
    RX packets:6 errors:0 dropped:0 overruns:0 frame:0
    TX packets:73 errors:0 dropped:0 overruns:0 carrier:0
    Kollisionen:0 Sendewarteschlangenlänge:1000
    RX bytes:0 (0.0 B) TX bytes:10365 (10.1 KiB)”

    Thank you very much for your kind help in advance!

    Kind regards 🙂

    • I have the same problem. Anyone have a solution?

    • I can’t talk to the Tor setup, but I got wlan0 on the Pi to have a static IP address with this in /etc/network/interfaces:

      allow hotplug wlan0
      iface wlan0 inet static
      address 192.168.0.34
      netmask 255.255.255.0

      Of course you’ll want to change the numbers to fit your network configuration.

  55. Thanks a lot. You made my day.

    I was busy trying to get things working without any success until I found this article. Great work!

    Next step is making my Pi work with my S4 via PiUi and finally installing the RPi time-laps controller both from David Singleton.

    Thnx.

  56. Hi,

    i followed your guid but it still does not work-.-
    when I try to connect my PC with the Hotspot/AP its not connectin and i loose my connection in putty. and then i loose the AP

  57. Is it possible to use two wifi dongles, and then create a wireless repeater? I have no idea what the network interfaces would look like.

  58. Dave –
    Great tutorial, I agree with the rest of the posts! I was previously stuck compiling kernel modules when I saw this post. This method is easier, and works!

    One question – I configured Tor with the setup you describe, but my public WLAN ip is not scrambled, it continues to be the same as my router (the non-RPi one), although all the Tor logs and diagnostics indicate it is working. Will it work with this bridged setup? It should be easy after the AP is setup, I would think.

  59. I tried using this tutorial with the SpillPassPi image from http://www.spillmonkey.com/?page_id=5 since I am trying to turn the Pi into a Nintendo Zone for Street Pass relays. The dongle I have (http://www.adafruit.com/products/1012#Description) doesn’t work with SpillPassPi, so I tried your tutorial since Windows device manager stated it used the trl8188cus driver. However, I could not get it to work. I assume I have to use Raspbian, which I will try tonight. I am totally new at this, so hopefully I can get it working.

  60. Doesn’t work for me:

    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid_ops
    ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
    wlan0: Setup of interface done.
    Wireless event: cmd=0x8b15 len=20

  61. Jon Cain

    Hello,

    I keep getting this looping problem at the end, I’ve tried this and several other tutorials and still get stuck at the same place:

    root@JonsRaspberryPi:~# sudo hostapd -dd /etc/hostapd/hostapd.conf
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    ctrl_interface_group=0
    drv->ifindex=3
    Configure bridge br0 for EAPOL traffic.
    BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
    Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=14 freq=2484 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm
    Completing interface initialization
    Mode: IEEE 802.11g Channel: 1 Frequency: 2412 MHz
    RATE[0] rate=10 flags=0x1
    RATE[1] rate=20 flags=0x1
    RATE[2] rate=55 flags=0x1
    RATE[3] rate=110 flags=0x1
    RATE[4] rate=60 flags=0x0
    RATE[5] rate=90 flags=0x0
    RATE[6] rate=120 flags=0x0
    RATE[7] rate=180 flags=0x0
    RATE[8] rate=240 flags=0x0
    RATE[9] rate=360 flags=0x0
    RATE[10] rate=480 flags=0x0
    RATE[11] rate=540 flags=0x0
    Flushing old station entries
    Deauthenticate all stations
    +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    Using interface wlan0 with hwaddr 80:1f:02:c9:29:f0 and ssid ‘JonCainPi’
    Deriving WPA PSK based on passphrase
    SSID – hexdump_ascii(len=9):
    4a 6f 6e 43 61 69 6e 50 69 JonCainPi
    PSK (ASCII passphrase) – hexdump_ascii(len=13): [REMOVED]
    PSK (from passphrase) – hexdump(len=32): [REMOVED]
    rtl871x_set_wps_assoc_resp_ie
    rtl871x_set_wps_beacon_ie
    rtl871x_set_wps_probe_resp_ie
    urandom: Got 20/20 bytes from /dev/urandom
    Get randomness: len=32 entropy=0
    GMK – hexdump(len=32): [REMOVED]
    Get randomness: len=32 entropy=0
    Key Counter – hexdump(len=32): [REMOVED]
    WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK – hexdump(len=32): [REMOVED]
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, JonCainPi,9
    rtl871x_set_acl
    wlan0: Setup of interface done.

    (Gets stuck here until I ctrl c)

    ^CSignal 2 received – terminating
    Flushing old station entries
    Deauthenticate all stations
    +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
    ELOOP: remaining socket: sock=7 eloop_data=0x1666810 user_data=(nil) handler=0x2a000

    Please help

    Thanks
    Jon

  62. Matthew Vortex

    Thank you SO much. I was just about to buy a new wifi dongle, but thanks to your instructions, I got my Belkin N150 dongle working. So funny that the hardware will support, but the software won’t (w/o your contribution).

    Note to all: it is rtL871xdrv. Kicked my butt for an hour trying to use the #1.

    Also, if your main goal is an adhoc network (like to an Android tablet or iphone) make sure you check Dave’s other article at:

    http://www.daveconroy.com/using-your-raspberry-pi-as-a-wireless-router-and-web-server/

    • Matthew Vortex

      Correction…dongle was a NETGEAR N150 (WNA1100). Router was a BELKIN.

  63. hzd98495

    Not working for now.
    The realtek driver from the realtek site supports only up to kernel version 3.9 and Raspbian is now using kernel version 3.10.

    The driver presented here by the author of the blog is even older and seriously outdated.

    The most promising solution at the moment is just buy a better dongle that is supported by raspbian.

    • hzd98495

      Well, apparently I was wrong…
      That kernel restriction I mentioned seems only to be important during compilation.
      The driver offered by the author of this blog does work…

      Please accept my sincere apologies, Dave

  64. Kuliczka

    Thank you very much!!! tested al lot of manuals(for the rtl8188CUS) who promised to do exactly this but non of them worked.

    Worked perfect for the first try!!!

  65. Hallo, I had also try your tutorial with my Raspberry and it works fine now. Now I want to install Tor but there is no new IP-Adresse cause its just a bridge to the wlan router. Can you please explain in few sentences how we can implement TOR now? Cause i’m not the only one who is interested in this following the other comments.
    Best Regards

  66. hzd98495@uikd.com

    I’m about to dump the RTL8188CUS based dongle in the trash and buy a better one.
    It seems impossible to get this thing working on N-band.

    G-band is perfect with near maximum speed. N-band is a disaster.
    If I specify a ht_capab line with whatever option on it (even [HT40+]) hostapd does come up, the network is detectable(!) but connecting is impossible. I even tried the ht_capab line suggested by Scott S a bit higher up in this thread.
    Just G-band does the job but performs not better than the standard consumer router available for a much lower price than a Raspberry.

    I did borrow a rt3070 based dongle (made by ralink) from a friend and that one does work. It even reaches 150 Mbit/s, so it’s near perfect.

    Apparently the RTL8188CUS chipset does not have (all of) the capabilities it advertizes with iw list.

    Is any one having suggestions to get the RTL8188CUS to accept connections?

  67. Hi, Could you post the configurations you did for the ‘.config’ when compiling the hostapd?
    I must be doing something wrong because it compiles fine but I get this message from running it:

    Starting advanced IEEE 802.11 management
    hostapdioctl[PRISM2_IOCTL_PRISM2_PARAM]: Bad address

    I’m also using Raspbian with the EDIMAX EW-7811Un adapter.

    • Never mind the “.config” question. My mistake. Once I added “driver=rtl871xdrv” to hostapd.config, the error went away and the hot spot was active.
      I mainly followed the directions at “http://elinux.org/RPI-Wireless-Hotspot” which provided the config entries for an ‘open’ AP. Those entries didn’t include a “driver” line.
      Then I compiled the sources you pointed out for the hostapd binary.
      Thanks for the helpful posts!

  68. I have the ssid running ok, and it is joinable, but I get no internet access when connected to it. If anyone has any ideas, please help. thanks

  69. thnx for the post…it worked on the laptop…but I cant connect to my android…and wifi does not show after reboot…in order to enable wifi I have to type sudo hostapd -dd /etc/hostapd/hostapd.conf everytime…how to enable it automatically…
    thnx

  70. Avni Jain

    Hi Dave

    I followed the entire tutorial as it is while an ssh and when i rebooted after making all changes as told my sd card didnt boot via ssh.
    I want to make this hotspot while ssh through putty.I am using a Huawei 3g dongle E220. I want my raspberry pi to act as a server while ssh. How can i solve this ?
    Are there any changes i need to make to the interfaces file ?

    I am working on a project whose one part is to get this working.

    Kindly help !

  71. msound76

    Great job, Dave!
    Your tutorial is perfect.
    Thanks a lot. Since I don’t want to have access point running all the time I want to ask you if there is a way to manually star & stop the service instead of add it to the startup.

  72. Hi Dave,
    just configured my EW-7811Un with 2 modifications:
    I recommend to set
    wpa=2
    and
    ieee80211=1
    to get maximum bandwidth and better security.
    EW-7811Un does its job perfectly, really good tutorial, thanks!

  73. Jordan314

    Re: my previous comment: I had udhcpd running which was a conflicting dhcp server. I had previously followed this tutorial (http://www.novitiate.co.uk/?p=183 ) that used it.
    Thanks to this forum (http://www.raspberrypi.org/forums/viewtopic.php?t=29536&p=263884 ) for the solution! And thanks for the amazing tutorial!

  74. Michael

    Brilliant! Thanks so much, really clear tutorial that worked as soon as I sorted out my typing!

  75. Tried to do this, but the link to your version of hostapd.zip is giving a 404 file not found error. I’ll try the realtek site. I have a generic dongle that lsusb reports is using the RT8188CUS chip, so I assume this will all work…

    The broken link:
    wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip

    • Grrr. Following the link I just posted above works for me,
      I had typed 08 instead of 07 on my RPi.

      Feel free to delete my two posts.

  76. Maxmad68

    My RPi doesn’t start
    Help me please

  77. Mengu Ucok

    Thank you, your tutorial worked with WN725N V2.0 perfectly, which has RTL8188EUS chipset.

  78. ChicagoBob123

    I still have problems with the RTL8188CUS. Just so frustrating. I have downloaded you driver and installed.
    I even built my own and tried them but when I restart hostapd I get
    Starting advanced IEEE 802.11 management: hostapdioctl[RTL_IOCTL_HOSTAPD]: Operation not supported . ok

    When I try to access the PI I see the PI but can not obtain an address most of the time. SOMETIMES I do and everything works.
    I am so lost.
    What does
    sudo hostapd -dd /etc/hostapd/hoastapd.conf
    do for you?
    Thanks hope someone can help.

  79. Followed the instructions, the network shows up on my iPhone. When I try and join the network I get “Unable to join the network “DaveConroyPi”. Check and the password is correct. Not sure what to do to resolve this!

    Thanks,
    Kyle

  80. Works like a charm – great tutorial, thanks!

  81. Hey all out there,
    i ve got a problem with this project.
    Everytime i type in this:

    sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak

    comes this response:

    mv: cannot stat `/usr/sbin/hostapd’: No such file or directory

    i have no idea whats the meaning of this is
    please help me

    such raspberry pi beginner
    notmarco

    • I have the same problem. I get a cannot stat error and I’m dead in the water to follow the tutorial any farther.

  82. I had to hard reboot following the reboot command to regain SSH control, but works great!!! thanks

  83. Dude
    awesome work right there, no other guide workeout for me but this…
    thhanks!

    • the only problem i seem havin is… idk like after 20 minutes or so the hotspot just stops, its still detectable by my devices but it has limited connectivity, then when i restart RASPI everythin is baq to normal for another 20 minutes or so, any ideas?

      • I did the same experience. After some time of idle, the SSID is not visible anymore. After reboot everything works fine.

  84. Hi Dave,

    This worked like a charm!!! Thanks

    I have a question. Is it possible to have the ssid hidden? Hope you can help me with this.

    Thanks in advance

  85. Hi Everything works great guide, however I have lost SSH connection via putty to rpi. I can not connect using SSH. And I need SSH to perform further activities. Can you help me get back SSH connectivity.

  86. HI awsome tut. However I have a problem

    I can successfully create the access point. But the moment I do that I loose connectivity with rpi via SSH or any IP which it gets. Access point is working perfectly but connect to rpi via SSH. If I remove the access point I can very well access rpi over SSH (putty) but not when I enable Access point I cannot use SSH. Can you please help me resolve this….

  87. If I change the ssid and passphrase it won’t log in. Actually, I can’t log in using the existing Daveconroypi SSID or Conroypi password.

    This is on my iphone and macbook. Suggestions?

  88. First thanks for this great guide!

    And for all those that have problems with SSH and PING after the setup.

    For me a “sudo iptables -F” (flushing iptables) worked just fine.

  89. i use wired internet service from my dormitory’s internet provider and they have very strict policy on filtering MAC address. I use RPi as an AP with wn725n USB wifi dongle and i’ve followed your guide. So how can i change RPi MAC address so that i can pass the MAC filter ?
    Sorry for my bad english

  90. After hours of testing i still have problems with the wlan driver.
    I use the latest version of raspbian (wheezy-24.12.2014) and the Edimax stick. Downloaded the special version of hostapd and prepared any file.
    If i start hostapd i get the message “invalid/unknown driver rtl1871xdrv”. lsusb shows me that the stick is attached and dmesg shows a realtek-wlan-adapter using rtl8192cu. lsmod shows that 8192cu is loaded. If i change the driver declaration in the conf file to rtl8192cu it got also the unkown driver message. Any ideas? Maybe something changed in wheezy????

  91. I have this all up and running, as a component of my security system.
    Problem is – I want to run it standalone, and when I disconnect the wired LAN, it will no longer authenticate.

    Any ideas on how to resolve this?
    I have two DHCP servers on the network operating behind bridges.

    I have a feeling my DHCP may not be working, and that it’s forwarding to a DHCP on the wired LAN somewhere.

  92. Himmelssonne.zoeblitz@gmail.com

    I have the following problem. I did everything as it was in the tutorial. I had been shown a network that was functional. But this network has collapsed after about 1 min and disappeared from the list of wireless connections. The Pi is 0.5m beside me. I used this adapter: https://www.vilros.com/raspberry-pi/wifi-adapter.html
    If the Netztwerk is just collapsed, I get it very difficult commis again. Insert again with multiple restarts of Pi and adapters. Can someone help what it could be?

  93. Himmelssonne

    I have the following problem. I did everything as it was in the tutorial. I had been shown a network that was functional. But this network has collapsed after about 1 min and disappeared from the list of wireless connections. The Pi is 0.5m beside me. I used this adapter: https://www.vilros.com/raspberry-pi/wifi-adapter.html
    If the Netztwerk is just collapsed, I get it very difficult commis again. Insert again with multiple restarts of Pi and adapters. Can someone help what it could be?

  94. Karl Ludwig

    Hey Dave, I tried your toutorial and it seems to work so far. But I am connect via Openconnect to a cisco VPN connection… Can you tell me, which addapter I have to use, because If I try eth0 as bridge-startpoint it doesn’t work…

  95. hardik gohil

    getting this error when i am trying to test the following:
    sudo hostapd -dd /etc/hostapd/hostapd.conf

    the error is:
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    Could not read interface wlan0 flags: No such device
    ioctl(SIOCGIFINDEX): No such device
    rtl871xdrv driver initialization failed.

    please suggest me and give some solution to this ….

  96. Works fine! thank you man!

  97. Hello, I have any probleme with this tutorial, first of all I cannot connected with my smartphone and second of all the conecttion with my computer work’s but wath is the adress of the router for connected with ssh

    Thank you for your response,

    Best regards

  98. How after connection with the hot spot open my webpage who run with apache on my pi

  99. Dave – great tutorial and thank you for the work to provide the driver and the hostapd binary. I used this with a Pi 1 Model B and B+ with no issues. I have been trying to use this same process on a Raspberry Pi 2 with Raspbian with little success. I had installed isc-dhcp-server and tftpd-hpa on this Pi2 and wanted to add the hostapd and wifi driver as well. It seems there is an incompatibility between hostapd and tftpd-hpa. I have not yet tried to compile the RTL wifi driver and the hostapd source on the Pi-2 yet, but I thought I would ask if you (or others) felt this might be necessary. What do you think?

  100. Antonis

    Hello,
    Thank you for your this nice tutorial. I followed the instructions and my AP works but with some problems. Right now I have my android phone and one ipad connected. Both devices disconnect all the time. Especially ipad finds really hard time connecting. My Ubuntu notebook does not discover the network. I can only connect manually through connection to secret network. Could it be too much load for such a small board, or there is something wrong with the driver?
    Please note that I am using rasberry b+ (512mb) and TP-Link TL-WN823N. I am pretty sure that the board does not reboot, because in that case I would receive automatic email with its IP.
    Thank you. 😀

  101. How do you get it to stop running the hotspot

  102. Peter Roth

    Dave,

    At the end of the process the hostapd -dd program stops after

    ioctl[RTL_IOCTL_HOSTAPD]: invalid argument
    wlano: setup of interface done

    Can you give me any clue of where to look. I am running on a Raspberry Pi 2 with the lateest release of Raspbian.

    Thanks for any suggestions.

    Peter

  103. thanx so so much you saved my life you made my day worked right out of the box

  104. Dave,
    Thanks for a great tutorial. I had previously followed this link: http://andrewmichaelsmith.com/2013/08/raspberry-pi-wi-fi-honeypot/
    but could not get it to work. However when I found your blog I realised that my Edimax dongle was the problem. So I made the changes to the /etc/hostapd/hostapd.conf file to match yours, and I was able to connect from my phone and use google.

    However if I try to add back the “address=/#/10.0.0.1” and “dhcp-range=10.0.0.10,10.0.0.250,12h” and “no-resolv” entries from Andrews blog it does not work. Can you see what I am trying to do and can you please suggest a fix?

  105. How do I get it to work with a ralink rt5370?
    thanks

  106. hardik gohil

    I have created a wifi hotspot using raspberry pi B+ model with TP link dongle, i want to forward all incoming traffic (Http request coming on port 80 & 443) to fix IP of my RPi…..
    -> sudo iptables -t nat -A PREROUTING -d 0/0 -p tcp –dport 80 -j DNAT –to-destination 192.168.0.101:80
    -> sudo iptables -t nat -A PREROUTING -d 0/0 -p tcp –dport 443 -j DNAT –to-destination 192.168.0.101:443

    m using this commands … but it doesn’t work well.. can any one help me out with this…..???

  107. stefanie

    Hi Dave,

    This guide is awesome. It works well. But the hotspot is unstable. Sometimes it disconnects randomly. Do you know why? For example the network at my home supposed to be named as stef_net. The raspberry pi’s hotspot is named as pi_net. My laptop is connected to pi_net but can’t go to internet randomly. But raspberry is still connected to stef_net. Because if I connect my laptop to stef_net again, I am able to ssh raspberry and reboot it.

  108. mlgspyda

    thank you SO MUCH! I tried at least 5 guides & none of them worked. followed yours step by step & BOOM! it’s working

  109. Many thanks.
    Clear concise instructions for swapping hostapd worked first time.

  110. allen

    The hotspot setting seems a sucess but I lost connection with the internet. I even cannot open the Google webpage, can you tell me what the problem is? Thank you.

  111. Suhas Patil

    I am unable to login to the access point even though I can see it in my ipad.

    I followed this document and verified it 2 times to see if I made a mistake. When I start
    /home/pi# hostapd -dd /etc/hostapd/hostapd.conf

    I see an error on console:
    ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument

    Is this error causing the problem and if so how do I fix it? Could you please help?

    • Wilson

      I get the same error and was wondering what it was myself.

      Anyone?

  112. I am using a Raspberry Pi 2, when running hostapd I get an error:
    Configure bridge br0 for EAPOL traffic.
    l2_packet_init: ioctl[SIOCGIFINDEX]: No such device
    no br0 interface , let l2_sock_recv==l2_sock_xmit=0x0x6c9638

    The ssid is visible from other devices but never authenticates. Can anyone help?

  113. mcgyver83

    I had problem authenticating to the new wifi network:
    IEEE 802.11: deauthenticated due to local deauth request

    Used a password with more than 8 chars (9 in my case) and all works fine!
    Thanks!!!!!!!!

  114. Wilson

    Thank you for the tutorial.
    Raspberry Pi 2, Kali linux, Eidimax USB dongle,
    For the life of me, I can not get any clients connected.
    The AP starts up and is broadcasting, then I try and connect.
    Eventually it times out and says in Win 8.1 (for example) “Can’t connect to this network.”
    I tried using many different devices.
    What is this? ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument ?

    My host file;
    ieee80211n=1
    interface=wlan0
    driver=rtl871xdrv
    bridge=br0
    ssid=helloworld
    channel=1
    wmm_enabled=0
    wpa=1
    wpa_passphrase=12345678
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP
    auth_algs=1
    macaddr_acl=0

    My interface file;
    #loopback adapter
    auto lo
    iface lo inet loopback

    #wired adapter
    iface eth0 inet dhcp

    #bridge
    auto br0
    iface br0 inet dhcp
    bridge_ports eth0 wlan0

    #auto wlan0
    allow-hotplug wlan0

    Here is the output while running hostapd;
    PSK (ASCII passphrase) – hexdump_ascii(len=8): [REMOVED]
    PSK (from passphrase) – hexdump(len=32): [REMOVED]
    rtl871x_set_wps_assoc_resp_ie
    rtl871x_set_wps_beacon_ie
    rtl871x_set_wps_probe_resp_ie
    random: Got 20/20 bytes from /dev/random
    Get randomness: len=32 entropy=0
    GMK – hexdump(len=32): [REMOVED]
    Get randomness: len=32 entropy=0
    Key Counter – hexdump(len=32): [REMOVED]
    WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK – hexdump(len=32): [REMOVED]
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid_ops
    ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
    wlan0: Setup of interface done.
    Wireless event: cmd=0x8b15 len=20
    Wireless event: cmd=0x8b15 len=20

    • Hi

      I have same issue as you, and as someone before; but cannot see the reply that could have been made.
      What is the solution to your problem? Do you know?

      Cheers,
      M

      • Hi,
        I also have the same problem. But unable to figure out the solution. Were you able to get a solution to your problem ?

        Thanks
        J

  115. Thank you so much, worked like a charm even couple of years later after initial tutorial.

  116. siulman

    Hi,
    here is the thing.
    I have a provider Router at home which only supports 802.11b/g.
    So when I do a file transfer over my wifi network I only get 2MBps maximum rate…that means about 40min for 1G movie…

    I Have a raspi so I think I could shut down the wifi on my provider router and activate access point on my raspi using this dongle.

    Will I have better rates during file transfer due to the wifi 802.11N ??

    I would like to know it before buying the dongle?

    Maybe a 300Mbps dongle would be better?

  117. Thank you for this great tutorial. Also installed the DHCP server according to your other tutorial and everything is working fine. Is there a chance to easily implement WPA2 instead of WPA encryption? Thanks.

  118. Asterisk

    Just wanted to thank you for the tutorial, as it got me an access point for $9 AUD and I learnt a few things as well.

    I was running this on the retropi build and plugged into the raspberrypi’s onboard usb and it was constantly authentication looping. Other people suggested this was due to the rPi not providing enough power. Plugging this into the USB hub and installing this on the latest NOOBS/Raspbian has it working flawlessly.

  119. Hi Dave, super tutorial – got my Onion Pi working- much appreciated!

  120. Hi,

    if you want use different subnets for your wired and your wireless networks I would suggest using NAT instead of the bridge. Adafruit has a nice tutorial for that:
    https://learn.adafruit.com/downloads/pdf/setting-up-a-raspberry-pi-as-a-wifi-access-point.pdf

  121. Hi there, thanks for a great, easy to follow tutorial. I am new to RPi and am of cause using these tutorials to help me learn my way around, so thank you.

    Having followed the instructions (I didn’t bridge the connections as I just want to access the PIi) all seemed to work, I was able to connect to the broadcasted network with my phone. I added to startup as you suggested and restarted however, that doesn’t want to work. The Pi boots into XBian/Kodi without issue, but the wifi dongle doesn’t do anything. Any thoughts?

    Cheers.
    James

    • D’Oh, for anyone reading, my issue on it not activating was simply a typo. Feeling rather silly. Now I can connect to the broadcast SSID, although the Kodi remote app cannot find Kodi to control. Hmmm,….

  122. Can you recommend a WiFi dongle with an external antenna that works with RaspberryPi2 ?

    I have a small one and connection is very slow and erratic :/ (my router is in another room)

  123. Adam Ericson

    Any luck getting this to work with osmc?

    I can connect to the AP but kodi doesn’t see my phone at all.
    Like it’s not on the same network.

    I want this for a car pc project I’m building.

    thank you!

  124. animator84

    Hi, I followed your tutorial, so far, its the best out there. I tried this wifi router on various ipv4 lan networks, all successful. But when i tried it on a ipv6 network, the WIFI point is seen, but cannot be connected. Any idea how I can solve this?

  125. Aashish

    I used Asus USB N10 for creating AP on Beablebone Black I was able to create access point using above but when I tried to connect that AP from other devices, it was showing error that “The Wi-Fi network didn’t respond” and the on terminal it was showing error like this :
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    drv->ifindex=4
    Configure bridge br0 for EAPOL traffic.
    BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
    Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm
    Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm
    Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm
    Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm
    Completing interface initialization
    Mode: IEEE 802.11b Channel: 1 Frequency: 2412 MHz
    RATE[0] rate=10 flags=0x1
    RATE[1] rate=20 flags=0x1
    RATE[2] rate=55 flags=0x0
    RATE[3] rate=110 flags=0x0
    Flushing old station entries
    Deauthenticate all stations
    +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    Using interface wlan0 with hwaddr f0:79:59:e5:f0:0c and ssid ‘DaveConroyPi’
    Deriving WPA PSK based on passphrase
    SSID – hexdump_ascii(len=12):
    44 61 76 65 43 6f 6e 72 6f 79 50 69 DaveConroyPi
    PSK (ASCII passphrase) – hexdump_ascii(len=8): [REMOVED]
    PSK (from passphrase) – hexdump(len=32): [REMOVED]
    rtl871x_set_wps_assoc_resp_ie
    rtl871x_set_wps_beacon_ie
    rtl871x_set_wps_probe_resp_ie
    random: Got 20/20 bytes from /dev/random
    Get randomness: len=32 entropy=0
    GMK – hexdump(len=32): [REMOVED]
    Get randomness: len=32 entropy=0
    Key Counter – hexdump(len=32): [REMOVED]
    WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
    Get randomness: len=16 entropy=0
    GTK – hexdump(len=16): [REMOVED]
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid_ops
    ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
    wlan0: Setup of interface done.
    Wireless event: cmd=0x8b15 len=20
    Wireless event: cmd=0x8c03 len=20
    +rtl871x_get_sta_wpaie, 28:47:aa:5a:e4:08 is sta’s address
    Add randomness: count=1 entropy=0
    wlan0: STA 28:47:aa:5a:e4:08 IEEE 802.11: associated
    STA included RSN IE in (Re)AssocReq
    New STA
    wlan0: STA 28:47:aa:5a:e4:08 WPA: event 1 notification
    rtl871x_set_key_ops
    IEEE 802.1X: Ignore STA – 802.1X not enabled or forced for WPS
    wlan0: STA 28:47:aa:5a:e4:08 WPA: start authentication
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state INITIALIZE
    rtl871x_set_key_ops
    wlan0: STA 28:47:aa:5a:e4:08 IEEE 802.1X: unauthorizing port
    WPA: 28:47:aa:5a:e4:08 WPA_PTK_GROUP entering state IDLE
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state AUTHENTICATION
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state AUTHENTICATION2
    WPA: Re-initialize GMK/Counter on first station
    Get randomness: len=32 entropy=1
    GMK – hexdump(len=32): [REMOVED]
    Get randomness: len=32 entropy=0
    Key Counter – hexdump(len=32): [REMOVED]
    Get randomness: len=16 entropy=0
    GTK – hexdump(len=16): [REMOVED]
    rtl871x_set_key_ops
    WPA: Assign ANonce – hexdump(len=32): 7b bf 07 4a 65 17 68 5a 30 6e 3c c2 83 92 be a1 89 6a ec 3a d4 a6 20 81 9f 7b c9 20 b7 e7 6c a0
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state INITPSK
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state PTKSTART
    wlan0: STA 28:47:aa:5a:e4:08 WPA: sending 1/4 msg of 4-Way Handshake
    WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)
    +rtl871x_send_eapol
    TX EAPOL – hexdump(len=113): 28 47 aa 5a e4 08 f0 79 59 e5 f0 0c 88 8e 02 03 00 5f 02 00 8a 00 10 00 00 00 00 00 00 00 01 7b bf 07 4a 65 17 68 5a 30 6e 3c c2 83 92 be a1 89 6a ec 3a d4 a6 20 81 9f 7b c9 20 b7 e7 6c a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 1)
    IEEE 802.1X: 121 bytes from 28:47:aa:5a:e4:08
    IEEE 802.1X: version=1 type=3 length=117
    WPA: Received Key Nonce – hexdump(len=32): d1 c0 ff aa 7c 58 4e 4b e9 32 38 a0 bf bb dc 98 c9 61 74 62 83 8a e8 c6 61 d3 84 76 bb 02 a4 cd
    WPA: Received Replay Counter – hexdump(len=8): 00 00 00 00 00 00 00 01
    Add randomness: count=2 entropy=0
    wlan0: STA 28:47:aa:5a:e4:08 WPA: received EAPOL-Key frame (2/4 Pairwise)
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state PTKCALCNEGOTIATING
    WPA: PTK derivation – A1=f0:79:59:e5:f0:0c A2=28:47:aa:5a:e4:08
    WPA: Nonce1 – hexdump(len=32): 7b bf 07 4a 65 17 68 5a 30 6e 3c c2 83 92 be a1 89 6a ec 3a d4 a6 20 81 9f 7b c9 20 b7 e7 6c a0
    WPA: Nonce2 – hexdump(len=32): d1 c0 ff aa 7c 58 4e 4b e9 32 38 a0 bf bb dc 98 c9 61 74 62 83 8a e8 c6 61 d3 84 76 bb 02 a4 cd
    WPA: PMK – hexdump(len=32): [REMOVED]
    WPA: PTK – hexdump(len=48): [REMOVED]
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state PTKCALCNEGOTIATING2
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state PTKINITNEGOTIATING
    wlan0: STA 28:47:aa:5a:e4:08 WPA: sending 3/4 msg of 4-Way Handshake
    WPA: Send EAPOL(version=2 secure=1 mic=1 ack=1 install=1 pairwise=8 kde_len=46 keyidx=1 encr=1)
    Plaintext EAPOL-Key Key Data – hexdump(len=56): [REMOVED]
    +rtl871x_send_eapol
    TX EAPOL – hexdump(len=169): 28 47 aa 5a e4 08 f0 79 59 e5 f0 0c 88 8e 02 03 00 97 02 13 ca 00 10 00 00 00 00 00 00 00 02 7b bf 07 4a 65 17 68 5a 30 6e 3c c2 83 92 be a1 89 6a ec 3a d4 a6 20 81 9f 7b c9 20 b7 e7 6c a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d2 a7 ec 7c de b5 42 c8 33 a1 23 27 c4 0b a2 ab 00 38 8f ee 94 e0 81 95 b5 e4 1f 70 69 25 92 67 ee 44 4d 71 b4 33 17 2d bc 5a ea 9f 6c 2a 60 3a 50 b9 88 e2 50 e4 54 1f 0a 9c 6e cc c9 23 74 01 1e 6b 37 5f ae 09 b3 82 85 ed
    WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 1)
    IEEE 802.1X: 99 bytes from 28:47:aa:5a:e4:08
    IEEE 802.1X: version=1 type=3 length=95
    WPA: Received Key Nonce – hexdump(len=32): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    WPA: Received Replay Counter – hexdump(len=8): 00 00 00 00 00 00 00 02
    wlan0: STA 28:47:aa:5a:e4:08 WPA: received EAPOL-Key frame (4/4 Pairwise)
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state PTKINITDONE
    rtl871x_set_key_ops
    wlan0: AP-STA-CONNECTED 28:47:aa:5a:e4:08
    wlan0: STA 28:47:aa:5a:e4:08 IEEE 802.1X: authorizing port
    wlan0: STA 28:47:aa:5a:e4:08 RADIUS: starting accounting session 560CEF4B-00000000
    wlan0: STA 28:47:aa:5a:e4:08 WPA: pairwise key handshake completed (RSN)
    Wireless event: cmd=0x8c04 len=20
    wlan0: STA 28:47:aa:5a:e4:08 IEEE 802.11: disassociated
    wlan0: AP-STA-DISCONNECTED 28:47:aa:5a:e4:08
    wlan0: STA 28:47:aa:5a:e4:08 WPA: event 2 notification
    rtl871x_set_key_ops
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state DISCONNECTED
    WPA: 28:47:aa:5a:e4:08 WPA_PTK entering state INITIALIZE
    rtl871x_set_key_ops
    wlan0: STA 28:47:aa:5a:e4:08 IEEE 802.1X: unauthorizing port
    +rtl871x_sta_remove_ops, 28:47:aa:5a:e4:08 is sta address removed

    Can anyone suggest anything? How to make it work?
    Regards,
    Aashish Khairnar

  126. JurgenRoman

    Hey Dave,

    Great tutorial, works like a charm

    Now i saw in the comments that you got the PIUI running with this setup, I tried it as well but didn’t go so well

    When i run the piui_demo.py script it does run it, but i can’t seem to go to 192.168.1.1 on my mobile phone (connected to the wifi from the pi) and see the webpage (it sais server not responding anymore)

    When i go to localhost:9999 on my pi i do get the webpage so it is hosting

  127. Awesome tutorial….Ive been looking for the past two weeks for an updated tutorial for this and this is the only one that worked..now if I can figure how to do the two wireless adapters instead of the wireless to eth0. Ill be set.

  128. i have a problem with starting the hostapd.conf at startup every thing works fine except the last step

  129. Quenthux

    Hi,

    Thank you very much for this tutorial, it works for me!
    However, after a while, the blue led of the adapter flashes slowly, and I don’t have internet access anymore…
    Does anyone have an idea?

    Quenthux

  130. Hi, y’all
    just after i installed all the special packages over the bridge utils hostapd the hostapd.conf disapears…

    So everytime i come to the point of configuring i can t to anything because there is no hostapd.conf.

    Any help would be appriciated…

    Cheers,

    Hein

  131. Hi! I’ve been reading your website for some time now and finally got the courage to go ahead
    and give you a shout out from Houston Tx! Just wanted to mention keep up the good
    job!

  132. Vance Turner

    Doesn’t like the driver.

    pi@AVION ~ $ hostapd -dd /etc/hostapd/hostapd.conf
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    ctrl_interface_group=0
    drv->ifindex=3
    l2_packet_init: socket(PF_PACKET): Operation not permitted
    rtl871xdrv driver initialization failed.
    rmdir[ctrl_interface]: No such file or directory

    I have this EDIMAX

    [ 4.651442] usbcore: registered new interface driver rtl8192cu

    If I change the driver reference I get this.# hostapd -dd /etc/hostapd/hostapd.conf
    random: Trying to read entropy from /dev/random
    Configuration file: /etc/hostapd/hostapd.conf
    Line 3: invalid/unknown driver ‘rtl8192cu’
    ctrl_interface_group=0
    1 errors found in configuration file ‘/etc/hostapd/hostapd.conf’

  133. I did your instructions with a WiFi dongle on a Raspberry pi B and it runs very well. I did the same with the same dongle in a Raspberry pi 2 and I see it on the PC but it doesn’t connect. But, if I comment out the instruction “wpa=1” on hostapd.conf it connects in open network. What is wrong with the authentication?

  134. bobbutts

    Worked well for awhile until I did a firmware update. I got it back up and running again using https://github.com/jenssegers/RTL8188-hostapd/archive/v2.0.tar.gz extract and make install from the hostapd dir.
    I had to manually put the Dave Conroy config’d hostapd.conf back because it got replaced.

  135. Brandon

    Hi, I have Ubuntu Server 14.04.3 LTS running on x86 64 bit processor. Can you compile a compatible hostapd file or know where I can get one that works with Ubuntu? I have a edimax and a intel server and would like to make use of it.

    If it’s not possible, do you have a recommendation on a good usb wifi adapter for ubuntu?

  136. WJCarpenter

    Dave, let me add my thanks for this write-up. The useful point for me was the whole business about using a custom hostapd. Who knew? My dongle is a TP-Link TL-725N, which uses a different Realtek chip and needs a different driver (8188eu instead of 8188cus. For whatever reason, Realtek didn’t have the source code for that chip driver in the same place. I found it elsewhere (https://github.com/lwfinger/rtl8188eu) and after poking around the sources for a while decided it was legit. Other than that, your recipe worked great.

  137. Excellent tutorial !!
    I am going on holidays to an apartment where only cable connection is available and and I will be able to connect all my wifi devices.
    After following some other tutorials I found online this is the only one that worked and at first attempt.
    Thank you very much mr. Conroy.

  138. Datguyoverthere

    Hello hostapd didnt work for me so i did some looking around and turns out i needed to update the driver so instead of using your part of the tutorial that installs the old driver i just ran this:

    cd /tmp
    sudo wget “ftp://95.130.192.218/cn/wlan/RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip” (without the quotes)
    sudo unzip RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip
    cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911
    cd wpa_supplicant_hostapd
    sudo tar -xvf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
    cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812
    cd hostapd
    sudo make
    sudo make install

    sudo mv hostapd /usr/sbin/hostapd
    sudo chown root.root /usr/sbin/hostapd
    sudo chmod 755 /usr/sbin/hostapd

  139. I tried the tutorial on a newly installed pi zero an Pi 2 but neither worked. I see the Wifi on my iPhone an Mac, but I can’t connect. The iPhone says wrong password an the Mac just says cannot connect…
    My apprehension is that the driver didn’t work with Raspian Wheezy or is there someone with a working setup under wheezy?

    • Sorry I meant JESSIE. It doesn’t work for my with Raspbian JESSIE

    • OK, its working with Wheezy on the RPi 2 but Wheezy isn’t working on the Zero ðŸ™?
      Think I have to get a compatible wifi stick for Jessie

  140. I am using a USB adapter ( TPLink WN-823N ) and a Raspberry Pi . I configured the captive portal perfectly . However, all the wi-fi clients connected to the captive portal seem to connect to each other although I set the ap_isolate flg to 1 in my hostapd file. Has anyone tried to configure this as I am guessing this is a pretty big security risk . Would this be a function of the wifi adapter ??

Trackbacks/Pingbacks

  1. Using your Raspberry Pi as a Wireless Router and Web Server | DaveConroy.com - [...] using the (previously) unsupported WiFi Adapter (RTL8188CUS chipset) that I wrote about in this Raspberry Pi WiFi Hotspot [...]
  2. Raspberry Pi WiFi Access Point | Warranty Void - [...] Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL8188CUS chipset) [...]
  3. Super duper WiFi dongles | PiStuffing - […] P.S. All the above dongles use the Realtek chipset, so, where soft AP is supported, can be used as…
  4. Turn your Raspberry Pi into a wifi hotspot with an Edimax dongle | Raspberry Pi Pod - […] I must’ve missed this one before. Dave Conroy has written a tutorial on turning your Pi into a wifi…
  5. Raspberry Pi WiFi Access Point – Crouze.com - […] Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL8188CUS chipset) […]

Leave a Reply

Your email address will not be published. Required fields are marked *