Skip to main content



# 常用的无线工具apk add iw wireless-tools wpa_supplicant
# 安装 pci 工具, busybox 的 lspci 信息较少apk add pciutils# 查看有没有无线控制器lspci | grep -i network
# 查看无线设备iw list
# 查看无线信息cat /proc/net/wireless
# 加载的驱动readlink /sys/class/net/wlan0/device/driver
# 网络硬件lshw -class network# 内核模块lsmod | grep iwlagn

博通 b43 固件#

apk add --allow-untrusted 编译后的.apkapk add b43-fwcuttermodprobe b43echo b43 >> /etc/modules
# 此时应该看得到网络设备iw list


  • iw
    • 替代 wireless-tools

monitor managed [also station] wds mesh [also mp] ibss [also adhoc] To see a description of these please read our modes documentation.

# 物理设备iw dev# 链路状态iw dev wlan0 link# AP 信息统计iw dev wlan0 station dump# 省电模式iw dev wlan0 set power_save on# 链接到网络iw wlan0 connect foo# 查看设备iw list# 热点扫描iw dev wlan0 scan
# 事件监听# -t tuming# -f framesiw event
# 设置设备模式iw phy phy0 interface add moni0 type monitor

iw help#

Usage:  iw [options] commandOptions:    --debug     enable netlink debugging    --version   show version (4.9)Commands:    help [command]    event [-t|-r] [-f]    features    commands    phy    list    phy <phyname> info    phy <phyname> channels    dev    dev <devname> info    dev <devname> del    dev <devname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]    phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]    dev <devname> ibss join <SSID> <freq in MHz> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>] [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] [key d:0:abcde]    dev <devname> ibss leave    dev <devname> station dump [-v]    dev <devname> station set <MAC address> mesh_power_mode <active|light|deep>    dev <devname> station set <MAC address> vlan <ifindex>    dev <devname> station set <MAC address> plink_action <open|block>    dev <devname> station del <MAC address> [subtype <subtype>] [reason-code <code>]    dev <devname> station get <MAC address>    dev <devname> survey dump    dev <devname> ocb leave    dev <devname> ocb join <freq in MHz> <5MHz|10MHz>    dev <devname> mesh leave    dev <devname> mesh join <mesh ID> [[freq <freq in MHz> <NOHT|HT20|HT40+|HT40-|80MHz>] [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>] [beacon-interval <time in TUs>] [dtim-period <value>] [vendor_sync on|off] [<param>=<value>]*    dev <devname> mpath dump    dev <devname> mpath set <destination MAC address> next_hop <next hop MAC address>    dev <devname> mpath new <destination MAC address> next_hop <next hop MAC address>    dev <devname> mpath del <MAC address>    dev <devname> mpath get <MAC address>    dev <devname> mpp dump    dev <devname> mpp get <MAC address>    dev <devname> scan [-u] [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]    dev <devname> scan sched_stop    dev <devname> scan sched_start [interval <in_msecs> | scan_plans [<interval_secs:iterations>*] <interval_secs>] [delay <in_secs>] [freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]    dev <devname> scan abort    dev <devname> scan trigger [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]    dev <devname> scan dump [-u]    phy <phyname> reg get    reg get    reg set <ISO/IEC 3166-1 alpha2>    dev <devname> auth <SSID> <bssid> <type:open|shared> <freq in MHz> [key 0:abcde d:1:6162636465]    dev <devname> connect [-w] <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1:6162636465]    dev <devname> disconnect    dev <devname> link    dev <devname> offchannel <freq> <duration>    dev <devname> cqm rssi <threshold|off> [<hysteresis>]    phy <phyname> wowlan show    phy <phyname> wowlan disable    phy <phyname> wowlan enable [any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request] [4way-handshake] [rfkill-release] [net-detect [interval <in_msecs> | scan_plans [<interval_secs:iterations>*] <interval_secs>] [delay <in_secs>] [freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]] [tcp <config-file>] [patterns [offset1+]<pattern1> ...]    phy <phyname> coalesce show    phy <phyname> coalesce disable    phy <phyname> coalesce enable <config-file>    dev <devname> roc start <freq> <time in ms>    wdev <idx> p2p stop    wdev <idx> p2p start    dev <devname> vendor recvbin <oui> <subcmd> <filename|-|hex data>    dev <devname> vendor recv <oui> <subcmd> <filename|-|hex data>    dev <devname> vendor send <oui> <subcmd> <filename|-|hex data>    phy <phyname> set antenna <bitmap> | all | <tx bitmap> <rx bitmap>    dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>]    phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>]    phy <phyname> set distance <auto|distance>    phy <phyname> set coverage <coverage class>    phy <phyname> set netns { <pid> | name <nsname> }    phy <phyname> set retry [short <limit>] [long <limit>]    phy <phyname> set rts <rts threshold|off>    phy <phyname> set frag <fragmentation threshold|off>    dev <devname> set channel <channel> [HT20|HT40+|HT40-]    phy <phyname> set channel <channel> [HT20|HT40+|HT40-]    dev <devname> set freq <freq> [HT20|HT40+|HT40-]    dev <devname> set freq <control freq> [20|40|80|80+80|160] [<center freq 1>] [<center freq 2>]    phy <phyname> set freq <freq> [HT20|HT40+|HT40-]    phy <phyname> set name <new name>    dev <devname> set mcast_rate <rate in Mbps>    dev <devname> set peer <MAC address>    dev <devname> set noack_map <map>    dev <devname> set 4addr <on|off>    dev <devname> set type <type>    dev <devname> set meshid <meshid>    dev <devname> set monitor <flag>*    dev <devname> set mesh_param <param>=<value> [<param>=<value>]*    dev <devname> set power_save <on|off>    dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]    dev <devname> get mesh_param [<param>]    dev <devname> get power_save <param>
Commands that use the netdev ('dev') can also be given the'wdev' instead to identify the device.
You can omit the 'phy' or 'dev' if the identification is unique,e.g. "iw wlan0 info" or "iw phy0 info". (Don't when scripting.)
Do NOT screenscrape this tool, we don't consider its output stable.


  • wireless-tools
    • 很久没有更新了
    • contents
    • iwconfig 基本无线参数管理
    • iwlist 列表扫描
    • iwspy 获取每个节点的信号强度
    • iwpriv 管理无线扩展相关的驱动
    • ifrename 网卡命名
# 查看无线信息iwconfig wlan0


# 启用网卡ifconfig wlan0 up# 扫描热点iwlist scan# 生成配置文件 wpa.confwpa_passphrase 热点名字 密码 > wpa.conf# 可添加多个配置wpa_passphrase 热点名字 密码 >> wpa.conf
# 将配置放到服务配置下mkdir -p /etc/wpa_supplicantchmod 750 /etc/wpa_supplicantcp wpa.conf /etc/wpa_supplicant/wpa_supplicant.conf
# 启动 wpa 服务rc-service wpa_supplicant start# 开机启动rc-update add wpa_supplicant boot
# 修改网络配置, 添加 wlan0# auto wlan0# iface wlan0 inet dhcpnano /etc/network/interface

# 调试# ===============# 在前台运行以便调试wpa_supplicant -Dwext -iwlan0 -c wpa.conf# busybox 自带了 udhcpcudhcpc -fqi wlan0


# Supported interface modes:#   AP - 支持 AP 模式iw list
apk add hostapd
# 如果已经连接了热点,确认先关闭service wpa_supplicant stop
# 测试配置cat <<CONF > test-ap.confinterface=wlan0driver=nl80211ssid=test-apchannel=1CONF# 启动后能搜到热点hostapd ./test-ap.conf
# 测试配置cat <<CONF > my-ap.confinterface=wlan0driver=nl80211ssid=wener-aphw_mode=nchannel=6macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=3wpa_passphrase=aaaaaaaawpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMPCONF
ip link set wlan0 downip addr flush dev wlan0ip link set wlan0 upip addr add dev wlan0
# 启动热点hostapd ./my-ap.conf# 启动 DHCPdnsmasq
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEiptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPTiptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT


apk add wavemonwavemon


802.11Mb/cMHz/cMax c操作频率 (MHz)

Mb/c 单通道最大速度 MHz/c 通道宽度


Understanding WiFi Signal Strength


adhoc vs ap#

  • adhoc
    • 没有接入点 - P2P - 点对点连接
    • 每一个节点都相当于路由
    • 类似于蓝牙
    • 用于临时互联
    • Wi-Fi Direct 基于 adhoc
  • ap - Infrastructure
    • 桥接网络
    • 工作性质类似于交换机
    • 数据通过一个节点进行分发传输
  • Wireless access point vs. ad hoc network

WiFi authentication times out#

echo "options iwlwifi 11n_disable=1 wd_disable=1" | sudo tee /etc/modprobe.d/iwlwifi.conf

brcmfmac: brcmf_cfg80211_scan: scan error#

brcmfmac: brcmf_run_escan: error (-52)brcmfmac: brcmf_cfg80211_scan: scan error (-52)brcmfmac: brcmf_escan_timeout: timer expired
echo 'options 8192cu rtw_power_mgnt=0 rtw_enusbss=0' >> /etc/modprobe.d/8192cu.conf


  • IBSS
  • managed
  • AP
  • monitor
  • P2P-client
  • P2P-GO
  • P2P-device
  • mesh point


  • [ SCAN_START_TIME ]: scan start timestamp
  • [ BSS_PARENT_TSF ]: BSS last beacon/probe TSF
  • [ SET_SCAN_DWELL ]: scan dwell setting
  • [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
  • [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
  • [ TXQS ]: FQ-CoDel-enabled intermediate TXQs


  • { managed } <= 1
  • { AP, P2P-client, P2P-GO } <= 1
  • { P2P-device } <= 1
  • total <= 3
  • channels <= 2
    • 允许工作在不同信道
# 创建虚拟网口 - ap+staiw dev wlan0 interface add wlan0_sta type managediw dev wlan0 interface add wlan0_ap type managed