but when I try to add virtual interface of AP type:
pi@bananapim2zero:~$ sudo iw dev wlan0 interface add wlan0_ap type ap addr 12:34:56:78:ab:cd
You need to run a management daemon, e.g. hostapd,
see http://wireless.kernel.org/en/users/Documentation/hostapd
for more information on how to do that.
I would like to start from no interface case, but I cannot delete that interface created automatically:
pi@bananapim2zero:~$ sudo iw dev wlan0 del
command failed: Unknown error 524 (-524)
pi@bananapim2zero:~$ sudo iw wdev 1 del
command failed: Unknown error 524 (-524)
pi@bananapim2zero:~$ sudo iw dev wlan0 interface del
command failed: Unknown error 524 (-524)
pi@bananapim2zero:~$ sudo iw wdev 1 interface del
command failed: Unknown error 524 (-524)
$ sudo iw dev wlan0 interface add wlan_ap type ap addr xxxx
You need to run a management daemon, e.g. hostapd,
see http://wireless.kernel.org/en/users/Documentation/hostapd
for more information on how to do that.
$ sudo systemctl status hostapd
��● hostapd.service - LSB: Advanced IEEE 802.11 management daemon
Loaded: loaded (/etc/init.d/hostapd; generated)
Active: active (exited) since Mon 2022-09-12 12:06:57 UTC; 4min 25s ago
Docs: man:systemd-sysv-generator(8)
Process: 1250 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)
Sep 12 12:06:57 bananapim2zero systemd[1]: Starting LSB: Advanced IEEE 802.11 management daemon...
Sep 12 12:06:57 bananapim2zero hostapd[1250]: * Starting advanced IEEE 802.11 management hostapd
Sep 12 12:06:57 bananapim2zero hostapd[1250]: ...fail!
Sep 12 12:06:57 bananapim2zero systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.
Do you know what creates that wlan0 interface. I would like to change its name there to wlan0_ap, expecting that hostapd would start then on the interface with that new name.
IIRC mainline driver does not have this functionality and you need to add it with a patch. I already looked around, but couldn’t find any useful reference. FYI
I was fooling around with this on a BPI-R64 quite a while ago, on Ubuntu, kernel mainline v5. It has a lot more capabilities, but in principle it is the same.
If iw reports the capabilities, this info is coming from the driver, so it should support it.
It can however be a bit more complex as it seems. For instance, the mac address needs to almost exactly match. In your case even more complex. You can only use the same channel on wlan_ap as wlan_sta. You’ll need to configure wpa_supplicant to use only the same channel as hostapd is.
The same goes for setting up a second AP (if it is supported), for instance for guest wifi. The mac address also need to almost exactly match, except for the last digit. But iw does not tell you this limitation. I still use this kind of setup, not a sta + ap combination currently.
unfortunatelly it is not working on Rpi-W-Zero-r1.1.
I started from this board because I would like to repeat others results, and then I planned to move to BPI.
I had following configuration:
Raspbian buster (the instructions were for Raspbian strech)
firmware: 20190114-1+rpt8 (I am aware that downgrade was recommended in one post)
Just for reference:
two wifi interfaces can be created,
after all steps I end with two wifi interfaces as DOWN,
it is possible to bring only one of them UP and start communication, but not both
The original description (by Albert Chaharbakhshi) is for raspbian/stretch. I read your script and the original post, then I implemented what was there described.
I am afraid that different version of the system or rather version of the firmware is the source of problem.
Regards,
Piotr Romaniuk
PS
I would like to check a version without udev rule, where phases are coded in systemd services. There was a note that order of operations is crucial.
Rpi-0-w_r1.1 - ap+sta can be configured and connected by both interfaces; it is possible to ping them; after some download wlan0 connection breaks down and cannot be recovered,
Rpi-0-w-2_r1.0 - as [1] but works stable download large files via both interfaces
Bpi-M2-zero - cannot obtain two interfaces UP; manufacturer claims that the chip in AP6212 module is not supporting ap+sta
I observed that two factors are critical:
version of the firmware (newer is not always better)
and the order of starting services.
Regards,
Piotr Romaniuk
PS
I wonder if the fixed and common channel is not a source of the problems. For example, if the wifi router decides to switch to another channel (that is different than used by AP) STA cannot find the router and connect to it again. I probably need to learn more about 802.11 in details.