iwconfig

iwconfig

轉載地址http://blog.chinaunix.net/uid-24467128-id-3201533.html

注意:radio層不支持該命令,該命令只在協議層使用。
用途:用於設置和操作WLAN接口,方法與ifconfig類似,但是是用於指定802.11設備的操作。
格式:iwconfig interface
   [essid {X|on|off|any}]
   [nwid {N|on|off}]
   [mode {M|Auto}]
   [freq F{k|M|G} ]
   [channel {C|auto|off}]
   [ap {A|off|auto|any}]
   [sens S]
   [nick {NAME}]
   [rate {R|auto|fixed}]
   [rts {RT|auto|fixed|off}]
   [frag {FT|auto|fixed|off}]
   [enc/key {EK|off|open}]
   [power {period P|timeout P|off}]
   [retry {limit R|lifetime R}]
   [txpower {T {mW|dBm} | auto | off}]
   [modu {M|auto}]
   [commit]
參數說明:

essid  #設置ESSID.如果ESSID包含any/on/off則需要在前面加"--"
 例子: #iwconfig ath0 essid any #允許任何ESSID,也就是混雜模式
    #iwconfig ath0 essid "My Network" #設置ESSID爲"My Network"
    #iwconfig ath0 essid --"ANY" #設置ESSID爲"ANY"

nwid #只用於早期的802.11無線網卡,
#現在的網卡利用ESSID和AP的MAC地址來替換nwid,所以該參數 基本上不用設備
例子:#iwconfig ath0 nwid Jake #設置nwid爲Jake

mode #設置無線網卡的工作模式,可以是:
    Ad-hoc: 不帶AP的點對點無線網絡
    Managed: 通過多個AP組成的網絡,無線設備可以在這個網絡中漫遊
    Master: 設置該無線網卡爲AP
    Repeater: 設置爲無線網絡中繼設備,可以轉發網絡包
    Secondary: 設置爲備份的AP/Repeater
    Monitor: 監聽模式
    Auto: 由無線網卡自動選擇工作模式
例子: #iwconfig ath0 mode Managed
    #iwconfig ath0 mode Master

freq #設置無線網卡的工作頻率
例子: #iwconfig ath0 freq 2.422G

channel ["num"|auto]#設置無線網卡的頻道
例子: #iwconfig ath0 channel 3
    #iwconfig ath0 channel auto

ap #連接到指定的AP或者無線網絡,後面參數可以是AP的MAC地址,
#也可以是iwlist scan出來的標識符。
#在AP環境下WDS客戶端模式連接AP或Ad-Hoc模式下客戶端連接ad-Hoc網絡。
例子:#iwconfig ath0 ap 00:11:22:33:44:55 #也可以是essid
    #iwconfig ath0 ap any    #自動選擇最好AP

sens #設置接收靈敏度的下限,在該下限之下,無線網卡會認爲該無線網絡信號太差,並採取相應操作
    #正的參數認爲是百分比數;負的參數表示dBm值。
例子:#iwconfig ath0 sens -85
    #iwconfig ath0 sens 60

nick #別名,一般不設置該參數
例子:#iwconfig ath0 nickname "Other name"

rate #如果無線網卡支持多速率,則可以通過該命令設置工作的速率。
例子:#iwconfig ath0 rate 5.5M
    #iwconfig ath0 rate 5.5M auto #自動選擇5.5M以下的速率
    #iwconfig ath0 rate auto

rts #指定RTS/CTS握手方式,使用RTS/CTS握手會增加額外開銷,
#但如果在無線網絡中有隱藏無線節點或者有很多無線節點時可以提高性能。
例子:#iwconfig ath0 rts 250 #指定該機制的最小包大小爲250.
    #iwconfig ath0 rts off #禁用該機制

frag #設置發送數據包的分片大小。
#設置分片會增加額外開銷,但在噪聲環境下可以提高數據包的到達率。
例子:#iwconfig ath0 frag 256 #設置分片大小爲256
    #iwconfig ath0 frag off #關閉分片機制

enc/key #設置無線網卡使用的加密密鑰,此處爲設置wep加密方式的密鑰,
#如果要使用WPA/WPA2需要wpa_supplicant工具包
#如果在密鑰之前加"[index]",則只是設置該索引值對應的密鑰,並不改變當前的密鑰
例子:#iwconfig ath0 key 1111-2222-33
    #iwconifg ath0 key [2] 1111-2222-33
    #iwconfig ath0 key s:password [3] #設置索引值[3]對應的密鑰爲password
    #iwconfig ath0 key [3]    #使用索引值[3]裏面的密鑰
    #iwconfig ath0 key open    #開啓加密功能
    #iwconfig ath0 key off    #關閉加密功能

power #設置無線網卡的電源管理模式;
    #period 'value'指定喚醒的週期;timeout 'value'指定進入休眠的等待時間。這些值默認單位爲秒
例子:#iwconfig ath0 power period 2 #隔2秒喚醒一次
    #iwconfig ath0 power 500m unicast
    #iwconfig ath0 power timeout 300u all
    #iwconfig ath0 power off
    #iwconfig ath0 power min period 2 power max period 4

retry #設置無線網卡的重傳機制。
例子: #iwconfig ath0 retry 16
    #iwconfig ath0 retry lifetime 300m #指定最長重試時間爲300毫秒,單位也可以是微秒u
    #iwconfig ath0 retry min limit 8 #指定最大重傳次數爲8次

txpower #如果無線網卡支持多發射功率設定,則使用該參數設定發射,單位爲dBm,
    #如果指定爲N(毫瓦mW),其轉換公式爲dBm=30+log(N)
例子:#iwconfig ath0 txpower 15
    #iwconfig ath0 txpower 30mW
    #iwconfig ath0 txpower auto #指定無線自動選擇發射功率
    #iwconfig ath0 txpower off #關閉發射單元

modu #指定網卡的調製方式
例子: #iwconfig ath0 modu 11g
    #iwconfig ath0 modu CCK OFDMa
    #iwconfig ath0 modu auto

commit #提交所有的參數修改給無線網卡驅動。一般不需使用到。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章