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+
DEAMON_CONF
var to point towards the hostapd.conf file. Running the latest version of Raspbian fully updated. – Fábio Antunes Mar 05 '16 at 18:11wlan-ap
has a static IP (see above), Confirmed withifconfig
. Also, to make sure thatudhcpd
service was working correctly, I temporary changedeth0
to a static IP almost like I was going to useeth0
instead ofwlan-ap
and configuredudhcpd.conf
to assign IP addresses to devices connected oneth0
, and it assigned a correct IP to my laptop when plugged via ethernet... In a nutshell, I confirmed DHCP would work for any new connected device. The problem ishostapd
or the device drive, I can't see the new wireless access point configured inhostapd.conf
– Fábio Antunes Mar 05 '16 at 18:22