openwrt学习
用iw命令行。同样,大多数Iwlist命令也失效了。
如下列出了iw的命令,虽然可通过这样的命令进行相关操作,但为了避免出错,建议还是使用web来进行操作,除非出于调试或测试目的。
列出所有命令行
Iw
列出所有命令及帮助
Iw help
列出设备支持能力,如带宽信息、802.11n信息
Iw list
扫描
Iw dev wlan0 scan
监听事件,调试目的
通过监听可打印出认证、关联帧信息
Iw event
-f :显示认证、关联帧(auth/assoc/deauth/disassoc frames) -t :显示时间戳信息
-r :显示相对时间戳(print relative timstamp)
获取链路状态(STA适用)
主要是判断是否关联到AP,适用于做为client。 Iw dev wlan0 link
建立连接
如果AP未加密或使用WEP加密,则可以通过iw来连接到此AP。
需要注意的是:当从AP断开连接时,经常出现busy的情况,需要reissue此命令。如果不想这样做,当断开时可通过wpa_supplicant来自动尝试reconnect。
版权所有?2012 成都科技有限公司 第 21 页 共 29 页
openwrt学习
假设SSID为foo的AP未加密,则可如下连接:
Iw wlan0 connect foo
假设有两个SSID为foo的AP,而我们要连接AP的频率是2432,则可如下连接: Iw wlan0 connect foo 2432
要连接到使用WEP加密的AP
iw wlan0 connect foo keys 0:abcde d:1:0011223344
获取STA统计信息
Iw dev wlan0 station dump
获取特定STA的统计
iw dev wlan1 station get
修改transmit bitrates
iw wlan0 set bitrates legacy-2.4 12 18 24
设置txpower
可设置到VAP设备接口或wlan物理接口
iw dev
省电模式
开启省电模式,对mac80211驱动来讲,即打开了Dynamic Power Save。
iw dev wlan0 set power_save on
获取省电模式配置
iw dev wlan0 get power_save
添加接口
当前支持的接口模式有:monitor、managed(also station)、wds、mesh(also mp)、ibss(also adhoc)。
创建monitor接口
版权所有?2012 成都科技有限公司
第 22 页 共 29 页
openwrt学习
iw phy phy0 interface add moni0 type monitor
其中moni0为接口名、monitor为模式,可替换。
当监视802.11n时,需要指定通道带宽(20或20/40MHz),对于20/40MHz要指定是upper还是lower通道。可通过如下命令设置:
iw dev
或:
iw phy
也可指定信道而不是频率:
iw phy
创建一个managed模式的接口:
iw phy phy0 interface add wlan10 type managed
注意:当使用hostapd时,接口会自动转换成AP模式。
删除接口
Iw dev
设置频率
iw dev wlan0 set freq 2412 [HT20|HT40+|HT40-]
设置信道
iw dev wlan0 set channel 1 [HT20|HT40+|HT40-]
设置RTS
phy
设置FRAG
phy
版权所有?2012 成都科技有限公司
第 23 页 共 29 页
openwrt学习
修改monitor接口标识
略
更新regulatory domain (国家码???)
iw reg set alpha2
其中alpha2是ISO/IEC 3166 alpha2国家码。 略
创建mesh 接口
略
设置WDS peer
为了创建WDS peer,需要首先创建WDS类型接口,然后设置peer。
iw phy phy0 interface add wds0 type wds iw dev wds0 set peer
为了正常工作,驱动必须实现cfg80211回调set_wds_peer()。Mac80211实现了此回调,因此mac80211驱动只需要支持WDS类型接口即可。当发送帧时,WDS会用对端的地址替换80211头的第一个地址。
Instead of using WDS though you may want to consider using 4-address mode described below if you have control over the software running on the AP and respective clients/peers connected.
AP和client模式使用4-address
In some situations it might be useful to run a network with an Access Point and multiple clients, but with each client bridged to a network behind it. For this to work, both the client and the AP need to transmit 4-address frames, containing both source and destination MAC addresses. Linux wireless has support for 4-address mode for AP and STAs but each driver needs to define this capability explicitly. All mac80211 drivers support 4-address mode if AP or STA modes of operation are supported respectively.
版权所有?2012 成都科技有限公司
第 24 页 共 29 页
相关推荐: