4

I'm trying to setup a Wireless Access Point with hostapd, however the AP is never visible after starting hostapd service.

Raspberry has two wireless interfaces of the same brand and model (RTL8192CU), however I'm only trying to use one with hostapd, the other one is used to connect Raspberry to my router for running SSH and configuring the device.

I don't know the reason for this problem. See the following configuration files and command output I think relevant in this situation.

Starting hostapd manually in verbose mode outputs the following.

$ hostapd -dd -B /etc/hostapd/hostapd.conf

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: interface wlan-ap in phy phy0
nl80211: Set mode ifindex 4 iftype 3 (AP)
nl80211: Failed to set interface 4 to mode 3: -19 (No such device)
nl80211: Could not configure driver mode
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=4 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 4 iftype 2 (STATION)
nl80211: Failed to set interface 4 to mode 2: -19 (No such device)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0xb7b0e9f0)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0xb7b0e9f0)
hostapd_bss_deinit: deinit bss wlan-ap
hostapd_cleanup(hapd=0xb7b0f5f8 (wlan-ap))
hostapd_free_hapd_data: Interface wlan-ap wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0xb7b0e9f0)
hostapd_interface_free: free hapd 0xb7b0f5f8
hostapd_cleanup_iface(0xb7b0e9f0)
hostapd_cleanup_iface_partial(0xb7b0e9f0)
hostapd_cleanup_iface: free iface=0xb7b0e9f0

It seems the interface wlan-ap doesn't exist. However ifconfig and iwconfig both disagree as you will see further bellow.

/etc/hostapd/hostapd.conf

interface=wlan-ap
ssid=My_AP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0

/etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

# Hostapd interface
auto wlan-ap
iface wlan-ap inet static
    address 192.168.200.1
    netmask 255.255.255.0

# Wlan interface
allow-hotplug wlan-connector
iface wlan-connector inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf    
# Network settings.
iface HomeNetwork inet static
    address 192.168.0.211
    network 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8 8.8.4.4

$ ifconfig wlan-ap

Link encap:Ethernet  HWaddr *************
BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$ iwconfig wlan-ap

unassociated  Nickname:"<WIFI@REALTEK>"
Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated   
Sensitivity:0/0  
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

$ dmesg | grep rtl

[    6.701824] usbcore: registered new interface driver rtl8192cu
[    6.712255] rtl8192cu 1-1.5:1.0 wlan-connector: renamed from wlan1
[    6.748025] rtl8192cu 1-1.3:1.0 wlan-ap: renamed from wlan0

These interfaces are of the same model. I'm using wlan-ap for hostapd, and wlan-connector to connect to my router for the solo purpose of running SSH and configuring the device to function as an Wlan AP.

$ iw wlan-ap info

command failed: No such device (-19)

I tried to use iw to find if the interface supports AP/Master mode. But to my disbelieve, iw couldn't find hostapd interface, for that matter it can't also find the interface I'm using to run these commands through SSH.

It makes no sense, on one side it can find the interface on another it can't.

Something wrong with my configuration or is it a drive issue?

Using the latest Raspbian version (headless), fully updated:

$ uname -r

4.1.18-v7+
Fábio Antunes
  • 149
  • 2
  • 4
  • 14

2 Answers2

3

For that particular card you need a special version of hostapd

Download the software from this URL: RTL8192CU.

The file is called "Linux Kernel 2.6.18~2.6.38 and Kernel 3.0.8..." version: 3.4.4_*

Then run these commands:

unzip RTL8192xC_USB_linux_*.zip
tar zxvf RTL8188C_8192C_USB_linux_*/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_*.tar.gz
cd wpa_supplicant_hostapd-0.8_*/hostapd/
make
sudo cp hostapd hostapd_cli /usr/local/sbin/

For Raspberry Pi you might want to change the line that says CFLAGS=... to CFLAGS=-MMD -Os in the Makefile.

There's a nice full explanation here: How to create an accesspoint using a RealTek 8192cu Usb Wifi Dongle.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
nwaltham
  • 311
  • 1
  • 6
0

you say you have updated to the latest raspbian release, if this is JESSIE then you are not supposed to edit the network/interface file.

How do I set up networking/WiFi/static IP address?. See this link.

Steve Gale
  • 31
  • 1