安装软件
opkg install hostapd-utils
使用 hostapd_cli
-i 指定网卡 使用 ifconfig获取
方法1
假设切换到信道4
hostapd_cli -i phy0-ap0 set channel 4
然后
hostapd_cli -i phy0-ap0 disable
hostapd_cli -i phy0-ap0 enable
才能生效 这样会导致客户端全体下线 再上线
方法2
hostapd_cli chan_switch
chan_switch <cs_count> [sec_channel_offset=] [center_freq1=] [center_freq2=] [bandwidth=] [blocktx] [ht|vht]
参数
cs_count:switch channel after how many beacon frames 在多少信标帧后切换信道
freq: 信道频率
bandwidth 可选 20MHz ; 40MHz
ht|vht 对应HT20 和 HT40
通过信道获取对应频率
物理网卡 phy0 对应 无线网卡,一个phy可以创建出多个 dev
指定 [值] 信道值
如 获取第7信道的频率
iw phy phy0 channels|grep “24” |grep -w [7]|awk -F " " ‘{print $2}’
或
第几行就是第几信道
iw phy phy0 channels|grep * |awk -F " " ‘{print $2}’|sed -n ‘4p’
iw phy phy0 channels|grep * |awk -F " " ‘{print $2}’|sed -n 3p’
实例