[英]Change hostapd BSSID
We have several devices that create an access point using wlan1
with hostapd
. 我们有几种设备使用
wlan1
和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. 问题在于,所有这些设备都为
wlan1
配备了相同的MAC地址,这会转换所有具有相同BSSID的设备,因此,当我们在一个范围内有多个设备时,我们将无法连接至它们中的任何一个。 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. 我们尝试了几种更改BSSID的方法,所有这些方法都会对
ifconfig
输出中显示的HWaddr
产生影响,但是当我们从客户端扫描网络时,看不到此更改,但是原始的BSSID所有设备。
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. 我们可以看到此
wlan1
接口的MAC地址存储在/sys/class/net/wlan1/address
,这是一个只读文件,其内容为: 02:03:7f:d7:00:01
,即我们为所有设备看到的BSSID。
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? 然后的问题是,我们如何更改AP的BSSID,以便在客户端看到效果,导致不同的网络具有不同的BSSID,以便在它们都处于范围内时可以建立与不同设备的连接?
/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
使用
SysVinit
在/usr/sbin/hostapd /etc/hostapd_wlan1.conf
运行
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)
ip link set wlan1 down
ip link set dev wlan1 address DC:EC:BE:91:EA:F1
ip link set wlan1 up
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)
change the .conf is useless because every time you reboot, a new conf will replace it. 更改.conf是没有用的,因为每次重新启动时,新的conf都会替换它。
in 在
/lib/netifd/wireless/mac80211.sh
mac80211_prepare_vif()
try to change $macaddr which is the final bssid. 尝试更改$ macaddr这是最终的bssid。
wish it will be helpful. 希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.