root@bpi-r3:/# cat /etc/hostapd/hostapd_wlan0.conf
#ctrl_interface=/var/run/hostapd
#ctrl_interface_group=0 # These 2 are just parameters so that the hostap daemon runs.
interface=wlan0
#interface=ap0
driver=nl80211
ssid=r3_AP0
hw_mode=g
#channel=2
#channel=4
channel=1
#macaddr_acl=0
auth_algs=1
#ignore_broadcast_ssid=0
wpa=2
wmm_enabled=1
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
root@bpi-r3:/#
5GHz
root@bpi-r3:/# cat /etc/hostapd/hostapd_wlan1.conf
ctrl_interface=/var/run/hostapd_2
#ctrl_interface_group=0 # These 2 are just parameters so that the hostap daemon runs.
interface=wlan1
#interface=ap0
driver=nl80211
ssid=r3_AP1
#2.4G
hw_mode=g
channel=1
#5G-Support
country_code=DE
ieee80211n=1
ieee80211d=1
hw_mode=a
#34-50 step 2
#channel=40
#channel=44
channel=36
ieee80211h=1
require_vht=1
ht_capab=[GF][HT40+][SHORT-GI-20][SHORT-GI-40][RX-STBC1][DSSS_CCK-40]
vht_oper_chwidth=1
vht_capab=[SHORT-GI-80][RX-STBC-1][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]
#42 would be the centered frequency center channel number for 36 primary
#channel only if this were a 80 MHz channel, so the combination here is
#invalid. You would either need to change this to use vht_oper_chwidth=1
#or set vht_oper_centr_freq_seg0_idx=0 if you want to use a 40 MHz
#channel.
vht_oper_centr_freq_seg0_idx=42
#channel=60
ieee80211ac=1
wmm_enabled=1
#security
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
#ignore_broadcast_ssid=0
auth_algs=1
#rsn_pairwise=CCMP
#macaddr_acl=0
#accept_mac_file=/etc/hostapd/acl_accept
#deny_mac_file=/etc/hostapd/acl_deny
#macaddr_acl=1
#accept_mac_file=/etc/hostapd/hostapd.allow
root@bpi-r3:/#
At the beginning, I was asking ways to configure modes (ap/managed/monitor/etc…) for wlan0 and wlan1. The default hostapd just brings up wlan0 but wlan1. That appears wlan0 operates in AP mode while wlan1 is in managed mode, by default.
After that, I commented a way I used to configure both interfaces in AP modes, even the system reboot.
It would be nice if you could share ways to configure various modes such as managed and monitor.
Yes, I’m able to operate WLAN interfaces in AP mode since the system already has /etc/hostapd/wlan*.conf, and I’ve hardcoded the /usr/lib/systemd/system/hostapd.service as above comment.
Do you know the ways to switch modes, e.g. ap, managed, monitor and etc…?
This file is part of the hostapd package and your changes are lost when the hostapd package is updated
This is why they introduced the template service, so you can use that instead of editing the service file.
Alternatively, you can use a drop-in file for the hostapd.service, where you can put your changes.
As for your changes about managed, you either run hostapd or wpa_supplicant on your wlan interface. Using it as accesspoint or client. Or what exactly do you want to change here?
Yes, I have already prepared the 2 config files /etc/hostapd/wlan*.conf as they are worked with the template service “systemctl restart hostapd@wlan*” in runtime.
A way to maintain changes after reboot which I know is to edit the hostapd.service file as above, i.e. hardcoding 2 separated services for wlan0 and wlan1.
Instead, could you provide example(s) to show how a drop-in file (with its filename, path, content) works with the 2 config files /etc/hostapd/wlan*.conf?
My aim is to hold 2 config files for wlan0 and wlan1 → save changes (e.g. ap/managed/monitor mode) there → restart service / reboot system → the changes being applied automatically.