Change hostapd BSSID

4.4k Views Asked by At

We have several devices that create an access point using wlan1 with hostapd. The problem is that all of them come with the same MAC address for wlan1, which translates in all the devices having the same BSSID, so when we have more than one device at range we cannot connect to any of them. We have tried to change the BSSID in several ways, and all of them have an effect on the HWaddr shown in the ifconfig output, but when we scan the network from a client, we don't see this change, but the original BSSID for all the devices instead.

We can see that the MAC address for this wlan1 interface is stored in /sys/class/net/wlan1/address, which is a read-only file with the content: 02:03:7f:d7:00:01, which is the BSSID that we see for all the devices.

The question is then how can we change the BSSID for the APs, so we can see an effect on the client side, resulting in different networks with different BSSIDs so we can establish connection to different devices when they are all at range?

Things we have tried to change the BSSID

With hostapd configuration file

/etc/hostapd_wlan1.conf

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=wlan1
driver=nl80211

# WPA2-AES encryption
bssid=DC:EC:BE:91:EA:F1
ssid=ap-wlan1-ccee
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_passphrase=password-wpa2aes

# IEEE 802.11ac
hw_mode=a
channel=36
ieee80211ac=1
ieee80211n=1

Which is run with /usr/sbin/hostapd /etc/hostapd_wlan1.conf using SysVinit

ifconfig output after reboot

wlan1   Link encap:Ethernet  HWaddr DC:EC:BE:91:EA:F1
        inet addr:192.168.46.30  Bcast:192.168.46.255  Mask:255.255.255.0
        inet6 addr: fe80::deec:beff:fe91:eaf1%lo/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:1016 errors:0 dropped:0 overruns:0 frame:0
        TX packets:977 errors:0 dropped:7 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:134304 (131.1 KiB)  TX bytes:135467 (132.2 KiB)

With ip commands

ip link set wlan1 down
ip link set dev wlan1 address DC:EC:BE:91:EA:F1
ip link set wlan1 up

ifconfig output

wlan1   Link encap:Ethernet  HWaddr DC:EC:BE:91:EA:F1
        inet addr:192.168.46.30  Bcast:192.168.46.255  Mask:255.255.255.0
        inet6 addr: fe80::deec:beff:fe91:eaf1%lo/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:1016 errors:0 dropped:0 overruns:0 frame:0
        TX packets:977 errors:0 dropped:7 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:134304 (131.1 KiB)  TX bytes:135467 (132.2 KiB)

WirelessNetView result for any case

enter image description here

1

There are 1 best solutions below

0
On

change the .conf is useless because every time you reboot, a new conf will replace it.

in

/lib/netifd/wireless/mac80211.sh 

mac80211_prepare_vif()

try to change $macaddr which is the final bssid.

wish it will be helpful.