Wpa_supplicant是linux系統下一個非常強大的無線網卡管理程序。google搜索到的它似乎不支持WPA2和AES,其實不然,參考它的文檔可以發現,WPA2只是RSN的別名,而AES也是CCMP的一部分,所以它們的支持完全是沒有問題的。
它的文檔看起來非常復雜,其實配置非常簡單,下面先給出我的wpa_supplication.conf
- ctrl_interface=/var/run/wpa_supplicant
- ctrl_interface_group=wheel
- update_config=1
- network={
- ssid="xxxx"
- scan_ssid=1
- psk=xxxxxxxxx37bca5cf24a345f514d319211822f568bba28f8f0b74c894e7644
- proto=RSN
- key_mgmt=WPA-PSK
- pairwise=CCMP
- auth_alg=OPEN
- }
解釋一下上面的比較容易困惑的地方:
簽名三句應該是個模板,沒仔細研究過。
network=開始是無線接入點的具體配置,一般的無線接入點可以用wpa_passphrase來自動生成,語法是
- yj@YJ_N ~ $ wpa_passphrase
- usage: wpa_passphrase <ssid> [passphrase]
- If passphrase is left out, it will be read from stdin
- 接下來看個實例:
- yj@YJ_N ~ $ wpa_passphrase TPLINK 12345678
- network={
- ssid="TPLINK"
- #psk="12345678"
- psk=992194d7a6158009bfa25773108291642f28a0c32a31ab2556a15dee97ef0dbb
- }
- 這里表示名為TPLINK的接入點,密碼是12345678,輸出就是該接入點在wpa_supplicant.conf里面的配置內容,可以直接用下面的命令自動寫入
- yj@YJ_N ~ $ wpa_passphrase TPLINK 12345678 |sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf
繼續解釋最開始的例子,network=后面的內容
ssid :接入點名稱,這個沒什么好說的
scan_ssid=1 :這個很容易錯過,如果你的無線接入點是隱藏的,那么這個就是必須的,親身經歷,折騰了好久才搞定,記之備忘。
psk=xx :是加密后的密碼,用wpa_passphrase自動生成的
proto=RSN WPA2就選這個,抄一下官方配置文件例子里面的:
- # proto: list of accepted protocols ---支持的協議列表
- # WPA = WPA/IEEE 802.11i/D3.0
- # RSN = WPA2/IEEE 802.11i (also WPA2 can be used as an alias for RSN) ---也能使用WPA2,它只是RSN的一個別名而已
- # If not set, this defaults to: WPA RSN ---如果不設置,默認就是WPA RSN,即全部支持
key_mgmt= 認證密鑰管理協議,還是抄:
- # key_mgmt: list of accepted authenticated key management protocols ---支持的協議列表
- # WPA-PSK = WPA pre-shared key (this requires 'psk' field) ---一般都是這個,這就包括了WPA、WPA2開始的那些方式
- # WPA-EAP = WPA using EAP authentication ---這個就是WEP開頭的,猜的,求驗證
- # IEEE8021X = IEEE 802.1X using EAP authentication and (optionally) dynamically
- # generated WEP keys
- # NONE = WPA is not used; plaintext or static WEP could be used ---這個是開放的,沒密碼,聯通、電信之類的就這個
- # WPA-PSK-SHA256 = Like WPA-PSK but using stronger SHA256-based algorithms
- # WPA-EAP-SHA256 = Like WPA-EAP but using stronger SHA256-based algorithms
- # If not set, this defaults to: WPA-PSK WPA-EAP ---如果未設置,默認支持WAP、WEP開頭那些
pairwise= 這個就是加密方式,繼續抄
- # pairwise: list of accepted pairwise (unicast) ciphers for WPA ---WPA可用的加密方式列表
- # CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] ---看到沒,這個就是AES,換了馬甲而已
- # TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] ---TKIP 這個倒是沒變
- # NONE = Use only Group Keys (deprecated, should not be included if APs support
- # pairwise keys) ---這個估計很少用
- # If not set, this defaults to: CCMP TKIP ---不設置的話是CCMP TKIP,看似正確,其實有些路由器無法自動識別,只能二選一,很坑爹。
好了,其他的不多說了,有興趣看英文原文吧: