Hostapd BSSID configuration

点点圈 提交于 2019-12-13 08:56:07

问题


We have a device that creates an access point using the MAC address of wlan1 as the BSSID. We are trying to change this default BSSID, and we somehow manage to do it, but it seems our changes don't take an effect on what the clients see as BSSID for the network.

The question is how to properly configure hostapd to run the access point with the BSSID we want it to have.

On the server side

We can see that our configuration has an effect on all the 3 places where we expect it to have it.

hostapd configuration file

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

# WPA2-AES encryption
ssid=ap-wlan1-ccee
bssid=02:03:7f:d7:00:04
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_passphrase=password-wpa2aes
max_num_sta=5

# IEEE 802.11ac
hw_mode=g
channel=7
ieee80211ac=1
ieee80211n=1

logger_stdout=-1
logger_stdout_level=2

hostapd output running /usr/sbin/hostapd /etc/hostapd_wlan1.conf

Configuration file: /etc/hostapd_wlan1.conf
wlan1: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface wlan1 with hwaddr 02:03:7f:d7:00:04 and ssid "ap-wlan1-ccee"
wlan1: interface state COUNTRY_UPDATE->ENABLED
wlan1: AP-ENABLED

ifconfig wlan1

wlan1     Link encap:Ethernet  HWaddr 02:03:7F:D7:00:04
          inet addr:192.168.46.30  Bcast:192.168.46.255  Mask:255.255.255.0
          inet6 addr: fe80::3:7fff:fed7:4%2126838504/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:15 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1890 (1.8 KiB)  TX bytes:5588 (5.4 KiB)

/sys/class/net/wlan1/address

02:03:7f:d7:00:04

On the client side

The server is exposing the wrong BSSID and therefore the negotiation fails.

WirelessNetView result

Wireshark result

We can see that the server sends from the proper address, but the client responds to the wrong one.


回答1:


Finally, it was the combination of hardware software we are using that was causing the problem. We are running a Yocto Linux image baked with Digi Embedded Yocto 2.0 in a Digi cc6ul module. These modules come with a U-Boot that has 3 variables for virtual interface MAC addresses: wlan1adrr, wlan2adrr and wlan3adrr. Turns out that on the cc6ul, the wlan1adrr variable is used to give a MAC to the p2p0 interface, where the one used to give a MAC to the wlan1 interface is wlan2addr. On top of that, the hostapd user configuration for the BSSID does not override the BSSID that is broadcast, which is directly the wlan2adrr value. The solution is the just change the wlan2addr U-Boot variable, then after reboot everything works!




回答2:


I think the log shows the src and dst address and not BSSID. so the dst matched with 02:03:7f:d7:00:04. Therefore the address you see on the client side is the mac address of the client. If you need to decode the BSSID, you might need to capture wireless packets



来源:https://stackoverflow.com/questions/51860818/hostapd-bssid-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!