I am trying to set an AP on a Raspberry Pi 3 using an external USB WiFi card and hostapd and dsnmasq. I have managed to achieve it using the internal WiFi card but when I try to switch to my external one I got the following error:
$ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan1 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan1: interface state UNINITIALIZED->DISABLED
wlan1: AP-DISABLED
hostapd_free_hapd_data: Interface wlan1 wasn't started
I believe it is because by default the hostapd is using nl80211
driver. This is the output of lsusb
- Bus 001 Device 004: ID 148f:3072 Ralink Technology, Corp. RT3072 Wireless Adapter
. And this is the output of lshw
*-network:1
description: Wireless interface
physical id: 3
bus info: usb@1:1.4
logical name: wlan1
serial: 98:3f:9f:24:a2:00
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=rt2800usb driverversion=4.14.71-v7+ firmware=0.36 ip=10.100.100.254 link=no m
ulticast=yes wireless=IEEE 802.11
So apparently this card is using the rt2080usb
driver but when I try to put it inside the hostapd.conf
and start manually the hostapd
I got the following error:
$ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Line 3: invalid/unknown driver 'rt2080usb'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'
Failed to set up interface with /etc/hostapd/hostapd.conf
Failed to initialize interface
And this is my hostapd.conf
file:
interface=wlan1
ssid=WiPi
driver=rt2080usb
hw_mode=g
ieee80211n=1
wmm_enabled=1
channel=4
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=wifipasswordhere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ht_capab=[HT20][SHORT-GI-20]
[EDIT] This is the output of the iwconfig
command:
wlan1 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short long limit:2 RTS thr:off Fragment thr:off
Power Management:off
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
And this is the output of the iw list
command:
valid interface combinations:
* #{ AP, mesh point } <= 8,
total <= 8, #channels <= 1
[EDIT 2] This is the output when I start the 'hostapd':
$ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Using interface wlan1 with hwaddr 98:3f:9f:24:a2:00 and ssid "WiPi"
random: Only 16/20 bytes of strong random data available from /dev/random
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
wlan1: interface state UNINITIALIZED->ENABLED
wlan1: AP-ENABLED
And this is the output of iwconfig
:
wlan1 IEEE 802.11 Mode:Master Tx-Power=20 dBm
Retry short long limit:2 RTS thr:off Fragment thr:off
Power Management:off
And this is the hostapd
log when I try to connect to my essid WiPi and run speedtest:
$ Configuration file: /etc/hostapd/hostapd.conf
Using interface wlan1 with hwaddr 98:3f:9f:24:a2:00 and ssid "WiPi"
wlan1: interface state UNINITIALIZED->ENABLED
wlan1: AP-ENABLED
wlan1: STA 94:65:2d:d4:e0:5b IEEE 802.11: authenticated
wlan1: STA 94:65:2d:d4:e0:5b IEEE 802.11: associated (aid 1)
wlan1: AP-STA-CONNECTED 94:65:2d:d4:e0:5b
wlan1: STA 94:65:2d:d4:e0:5b RADIUS: starting accounting session 5BEC735C-00000000
wlan1: STA 94:65:2d:d4:e0:5b WPA: pairwise key handshake completed (RSN)
wlan1: AP-STA-DISCONNECTED 94:65:2d:d4:e0:5b
Failed to set beacon parameters
wlan1: INTERFACE-DISABLED
wlan1: INTERFACE-ENABLED
Failed to set beacon parameters
wlan1: INTERFACE-DISABLED
wlan1: INTERFACE-ENABLED
Failed to set beacon parameters
handle_probe_req: send failed
[EDIT 3]: I have run the hostapd
in debug mode sudo hostapd -dd -P /run/hostapd.pid -B -f /tmp/hostapd.log /etc/hostapd/hostapd.conf
set to on and uploaded the log file to pastebin
iw list
report under "valid interface combinations" for your WiFi adapter?sudo killall wpa_supplicant
andsudo killall hostapd
. Then try again withsudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
using your original hostapd.conf file (withdriver=nl80211
). One reason where you get the error message you see, is that the interface is already used by another process.iwconfig
say after this happens? Are you still in master mode, or back to managed mode? 2) Is the dissappearance of the AP really related to the connection attempt or does it simply happen a constant period after starting the AP? 3) Did you try with a more basic hostapd.conf, e.g. the one from the RPi? raspberrypi.org/documentation/configuration/wireless/…