之前遇到了点阻碍,不过还是顺利找到解决方法。
首先你要确定你自己用的USB-WIFI是什么芯片,然后去找官网提供的驱动包,自己进行编译。
而我用的是rt2070的USB-WIFI,所以,我这里就只介绍如何编译rt2070吧。
第一步,scan-wifi。激活wlan0。输入scan-wifi即可。scan-wifi是友善提供的工具。
cfg80211: Calling CRDA to update world regulatory domain libertas_sdio: Libertas SDIO driver libertas_sdio: Copyright Pierre Ossman usbcore: registered new interface driver ath9k_htc usbcore: registered new interface driver rt73usb usb 1-1.3: reset full speed USB device using s3c2410-ohci and address 3 usbcore: registered new interface driver rt2800usb rtw driver version=v3.0.1590.20110511 usbcore: registered new interface driver rtl8192cu usbcore: registered new interface driver zd1211rw
第二步,设置wpa_supplicant.conf
vi /etc/wpa_supplicant.conf
内容为:
ctrl_interface=/var/run/wpa_supplicant network={ ssid="xxxx" //这里xxxx指的是你无线网络名字 proto=WPA key_mgmt=WPA-PSK //你选的是什么安全设置你就写哪种。我选的第一种,所以就是WPA-PSK psk="*****" //*****指密码。 }
第三步,静态设置wlan0的IP
ifconfig wlan0 192.168.1.101
第四步,用wpa_supplicant连接上网
wpa_supplicant -dd -Dwext -iwlan0 -c /etc/wpa_supplicant.conf &
-d :增加调试信息
-Dwext :wext,驱动名称
-iwlan0 :wlan0,网络接口名称
/etc/wpa_supplicant.conf :wpa_supplicant的配置文件path
这里需要注意的是,当你输入这个命令后,出现如下提示:
Try to find WPA-enabled AP 0: 0a:25:12:6b:1f:f6 ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 5: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 6: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE Try to find non-WPA AP 0: 0a:25:12:6b:1f:f6 ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 5: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 6: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch No suitable AP found.
你可以先在里面找找是否有你设的无线网络,如果有,你看一下双引号里面的是什么,比如“linux” ,linux是我设的无线网,如果发现你的无线网后面有个空格,就跟这里linux后面有个空格一样。那你就注意,你是不是在设置无线网的时候多加个空格,这时候你有两种方法,第一种,改无线网名,把空格去掉,第二种就是修改wpa_supplicant.conf文件,在ssid后面的双引号里加个空格,跟提示的对应,都可以。
我的成功连接的打印信息如下:
[root@FriendlyARM /]# wpa_supplicant -dd -Dwext -iwlan0 -c /etc/wpa_supplicant.c onf & [root@FriendlyARM /]# Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A' Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf' Reading configuration file '/etc/wpa_supplicant.conf' ctrl_interface='/var/run/wpa_supplicant' Line: 2 - start of a new network block ssid - hexdump_ascii(len=5): 6c 69 6e 75 78 linux proto: 0x1 key_mgmt: 0x2 PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED] PSK (from passphrase) - hexdump(len=32): [REMOVED] Priority group 0 id=0 ssid='linux' Initializing interface (2) 'wlan0' SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf capabilities: key_mgmt 0xf enc 0xf flags 0x0 WEXT: Operstate: linkmode=1, operstate=5 Own MAC address: 48:02:2a:24:35:55 wpa_driver_wext_set_wpa wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0 wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0 wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0 wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0 wpa_driver_wext_set_countermeasures wpa_driver_wext_set_drop_unencrypted RSN: flushing PMKID list in the driver Setting scan request: 0 sec 100000 usec EAPOL: SUPP_PAE entering state DISCONNECTED EAPOL: KEY_RX entering state NO_KEY_RECEIVE EAPOL: SUPP_BE entering state INITIALIZE EAP: EAP entering state DISABLED Added interface wlan0 RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b06 len=8 RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b1a len=40 State: DISCONNECTED -> SCANNING Starting AP scan (broadcast SSID) Trying to get current scan results first without requesting a new scan to speed up initial association ioctl[SIOCGIWSCAN]: Resource temporarily unavailable Failed to get scan results Failed to get scan results - try scanning again Setting scan request: 0 sec 0 usec Starting AP scan (broadcast SSID) ioctl[SIOCSIWSCAN]: Device or resource busy Scan requested (ret=-1) - scan timeout 5 seconds Failed to initiate AP scan. Setting scan request: 10 sec 0 usec EAPOL: disable timer tick RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 1345 bytes of scan results (4 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 2: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 3: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE Try to find non-WPA AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 2: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 3: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch No suitable AP found. Setting scan request: 5 sec 0 usec Starting AP scan (broadcast SSID) Scan requested (ret=0) - scan timeout 30 seconds RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 1682 bytes of scan results (5 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 2: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 3: 06:25:12:6b:1f:a8 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 4: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE Try to find non-WPA AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 2: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 3: 06:25:12:6b:1f:a8 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 4: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch No suitable AP found. Setting scan request: 5 sec 0 usec Starting AP scan (broadcast SSID) Scan requested (ret=0) - scan timeout 30 seconds RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 2667 bytes of scan results (8 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 5: 06:25:12:6b:1f:a8 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 6: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 7: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE Try to find non-WPA AP 0: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 00:25:12:6b:1f:f6 ssid='CMCC' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 5: 06:25:12:6b:1f:a8 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 6: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 7: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch No suitable AP found. Setting scan request: 5 sec 0 usec Starting AP scan (broadcast SSID) Scan requested (ret=0) - scan timeout 30 seconds RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 2345 bytes of scan results (7 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: 0a:25:12:6b:1f:f6 ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 5: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE 6: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - no WPA/RSN IE Try to find non-WPA AP 0: 0a:25:12:6b:1f:f6 ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 1: 0a:25:12:62:a4:0b ssid='' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 skip - SSID not known 2: 06:25:12:62:a4:0b ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID not known 3: 00:23:89:99:72:50 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 4: 00:23:89:99:72:51 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 5: 00:23:89:98:f7:90 ssid='ChinaNet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch 6: 00:23:89:98:f7:91 ssid='GDUPT' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 skip - SSID mismatch No suitable AP found. Setting scan request: 5 sec 0 usec Starting AP scan (broadcast SSID) Scan requested (ret=0) - scan timeout 30 seconds RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 3268 bytes of scan results (9 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: ec:17:2f:60:45:a8 ssid='linux' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 selected based on WPA IE selected WPA AP ec:17:2f:60:45:a8 ssid='linux' Trying to associate with ec:17:2f:60:45:a8 (SSID='linux' freq=2437 MHz) Cancelling scan request WPA: clearing own WPA/RSN IE Automatic auth_alg selection: 0x1 WPA: using IEEE 802.11i/D3.0 WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 1 WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 WPA: set AP RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 WPA: using GTK CCMP WPA: using PTK CCMP WPA: using KEY_MGMT WPA-PSK WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 No keys have been configured - skip key clearing wpa_driver_wext_set_drop_unencrypted State: SCANNING -> ASSOCIATING wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT) WEXT: Operstate: linkmode=-1, operstate=5 wpa_driver_wext_associate wpa_driver_wext_set_psk Setting authentication timeout: 10 sec 0 usec EAPOL: External notification - EAP success=0 EAPOL: External notification - EAP fail=0 EAPOL: External notification - portControl=Auto RSN: Ignored PMKID candidate without preauth flag RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b06 len=8 RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b04 len=12 RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b1a len=13 RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b19 len=8 Received 3620 bytes of scan results (10 BSSes) New scan results available Selecting BSS from priority group 0 Try to find WPA-enabled AP 0: ec:17:2f:60:45:a8 ssid='linux' wpa_ie_len=22 rsn_ie_len=20 caps=0x11 selected based on WPA IE selected WPA AP ec:17:2f:60:45:a8 ssid='linux' Already associated with the selected AP. RSN: Ignored PMKID candidate without preauth flag RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8c08 len=154 AssocResp IE wireless event - hexdump(len=146): 01 08 02 04 0b 0c 12 16 18 24 32 04 30 48 60 6c 2d 1a 6e 10 03 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 1a 6e 10 03 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 06 05 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 16 06 05 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 18 00 50 f2 02 01 01 03 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added Wireless event: cmd=0x8b15 len=20 Wireless event: new AP: ec:17:2f:60:45:a8 Association info event resp_ies - hexdump(len=146): 01 08 02 04 0b 0c 12 16 18 24 32 04 30 48 60 6c 2d 1a 6e 10 03 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 1a 6e 10 03 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 06 05 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 16 06 05 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 18 00 50 f2 02 01 01 03 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 State: ASSOCIATING -> ASSOCIATED wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT) WEXT: Operstate: linkmode=-1, operstate=5 Associated to a new BSS: BSSID=ec:17:2f:60:45:a8 No keys have been configured - skip key clearing Associated with ec:17:2f:60:45:a8 WPA: Association event - clear replay counter WPA: Clear old PTK EAPOL: External notification - portEnabled=0 EAPOL: External notification - portValid=0 EAPOL: External notification - EAP success=0 EAPOL: External notification - portEnabled=1 EAPOL: SUPP_PAE entering state CONNECTING EAPOL: enable timer tick EAPOL: SUPP_BE entering state IDLE Setting authentication timeout: 10 sec 0 usec Cancelling scan request RX EAPOL from ec:17:2f:60:45:a8 RX EAPOL - hexdump(len=99): 02 03 00 5f fe 00 8a 00 10 00 00 00 00 00 00 00 02 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Setting authentication timeout: 10 sec 0 usec IEEE 802.1X RX: version=2 type=3 length=95 EAPOL-Key type=254 key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack) key_length=16 key_data_length=0 replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 02 key_nonce - hexdump(len=32): 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00 key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00 key_mic - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 WPA: RX EAPOL-Key - hexdump(len=99): 02 03 00 5f fe 00 8a 00 10 00 00 00 00 00 00 00 02 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 State: ASSOCIATED -> 4WAY_HANDSHAKE WPA: RX message 1 of 4-Way Handshake from ec:17:2f:60:45:a8 (ver=2) WPA: Renewed SNonce - hexdump(len=32): ad ca 44 6f 07 8e 7b 56 83 79 f9 fe 36 5b 1f 20 fc 59 a5 de b6 e2 e9 a1 28 c6 c0 54 53 9f 30 40 WPA: PTK derivation - A1=48:02:2a:24:35:55 A2=ec:17:2f:60:45:a8 WPA: PMK - hexdump(len=32): [REMOVED] WPA: PTK - hexdump(len=48): [REMOVED] WPA: WPA IE for msg 2/4 - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 WPA: Sending EAPOL-Key 2/4 WPA: TX EAPOL-Key - hexdump(len=123): 01 03 00 77 fe 01 0a 00 10 00 00 00 00 00 00 00 02 ad ca 44 6f 07 8e 7b 56 83 79 f9 fe 36 5b 1f 20 fc 59 a5 de b6 e2 e9 a1 28 c6 c0 54 53 9f 30 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f0 b1 99 bc 2d 0a 68 8a 6d c1 b7 6f 84 af b5 80 00 18 dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 RX EAPOL from ec:17:2f:60:45:a8 RX EAPOL - hexdump(len=123): 02 03 00 77 fe 01 ca 00 10 00 00 00 00 00 00 00 03 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2c 4e b4 c8 b4 f1 49 6d 62 47 0f 51 19 9c 16 44 00 18 dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 IEEE 802.1X RX: version=2 type=3 length=119 EAPOL-Key type=254 key_info 0x1ca (ver=2 keyidx=0 rsvd=0 Pairwise Install Ack MIC) key_length=16 key_data_length=24 replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 03 key_nonce - hexdump(len=32): 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00 key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00 key_mic - hexdump(len=16): 2c 4e b4 c8 b4 f1 49 6d 62 47 0f 51 19 9c 16 44 WPA: RX EAPOL-Key - hexdump(len=123): 02 03 00 77 fe 01 ca 00 10 00 00 00 00 00 00 00 03 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2c 4e b4 c8 b4 f1 49 6d 62 47 0f 51 19 9c 16 44 00 18 dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE WPA: RX message 3 of 4-Way Handshake from ec:17:2f:60:45:a8 (ver=2) WPA: IE KeyData - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02 WPA: Sending EAPOL-Key 4/4 WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f fe 01 0a 00 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d4 c6 6b 06 6a 29 3f b3 75 f3 a5 e6 fb ae 3c fd 00 00 WPA: Installing PTK to the driver. WPA: RSC - hexdump(len=6): 00 00 00 00 00 00 wpa_driver_wext_set_key: alg=3 key_idx=0 set_tx=1 seq_len=6 key_len=16 State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE RX EAPOL from ec:17:2f:60:45:a8 RX EAPOL - hexdump(len=123): 02 03 00 77 fe 03 92 00 10 00 00 00 00 00 00 00 04 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a6 f8 fb ca 47 36 3b 50 1f 81 2c 85 fe bb 56 91 00 18 9c be 46 9f 50 2a 29 c8 c7 21 95 75 e6 29 0c af d5 04 dc 31 30 c8 51 36 IEEE 802.1X RX: version=2 type=3 length=119 EAPOL-Key type=254 key_info 0x392 (ver=2 keyidx=1 rsvd=0 Group Ack MIC Secure) key_length=16 key_data_length=24 replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 04 key_nonce - hexdump(len=32): 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00 key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00 key_mic - hexdump(len=16): a6 f8 fb ca 47 36 3b 50 1f 81 2c 85 fe bb 56 91 WPA: RX EAPOL-Key - hexdump(len=123): 02 03 00 77 fe 03 92 00 10 00 00 00 00 00 00 00 04 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a6 f8 fb ca 47 36 3b 50 1f 81 2c 85 fe bb 56 91 00 18 9c be 46 9f 50 2a 29 c8 c7 21 95 75 e6 29 0c af d5 04 dc 31 30 c8 51 36 WPA: RX message 1 of Group Key Handshake from ec:17:2f:60:45:a8 (ver=2) State: GROUP_HANDSHAKE -> GROUP_HANDSHAKE WPA: Group Key - hexdump(len=16): [REMOVED] WPA: Installing GTK to the driver (keyidx=1 tx=0 len=16). WPA: RSC - hexdump(len=6): 00 00 00 00 00 00 wpa_driver_wext_set_key: alg=3 key_idx=1 set_tx=0 seq_len=6 key_len=16 WPA: Sending EAPOL-Key 2/2 WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f fe 03 12 00 10 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 5f 97 99 3a 9b 94 df b4 0a 12 8b b5 a7 41 22 00 00 WPA: Key negotiation completed with ec:17:2f:60:45:a8 [PTK=CCMP GTK=CCMP] Cancelling authentication timeout State: GROUP_HANDSHAKE -> COMPLETED CTRL-EVENT-CONNECTED - Connection to ec:17:2f:60:45:a8 completed (auth) [id=0 id_str=] wpa_driver_wext_set_operstate: operstate 0->1 (UP) WEXT: Operstate: linkmode=-1, operstate=6 EAPOL: External notification - portValid=1 EAPOL: External notification - EAP success=1 EAPOL: SUPP_PAE entering state AUTHENTICATING EAPOL: SUPP_BE entering state SUCCESS EAP: EAP entering state DISABLED EAPOL: SUPP_PAE entering state AUTHENTICATED EAPOL: SUPP_BE entering state IDLE EAPOL authentication completed successfully RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added EAPOL: startWhen --> 0 EAPOL: disable timer tick RX EAPOL from ec:17:2f:60:45:a8 RX EAPOL - hexdump(len=123): 02 03 00 77 fe 03 92 00 10 00 00 00 00 00 00 00 06 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ee 54 68 ce 37 45 01 c5 cd bd 69 3b 63 93 a0 e3 00 18 9c be 46 9f 50 2a 29 c8 c7 21 95 75 e6 29 0c af d5 04 dc 31 30 c8 51 36 IEEE 802.1X RX: version=2 type=3 length=119 EAPOL-Key type=254 key_info 0x392 (ver=2 keyidx=1 rsvd=0 Group Ack MIC Secure) key_length=16 key_data_length=24 replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 06 key_nonce - hexdump(len=32): 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00 key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00 key_mic - hexdump(len=16): ee 54 68 ce 37 45 01 c5 cd bd 69 3b 63 93 a0 e3 WPA: RX EAPOL-Key - hexdump(len=123): 02 03 00 77 fe 03 92 00 10 00 00 00 00 00 00 00 06 98 79 62 5a 11 d0 e9 78 95 8d 2f 2d 3e 55 33 35 21 ff 28 cd eb 9b f8 6e 3f b2 2a f5 9b e2 6d 5f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ee 54 68 ce 37 45 01 c5 cd bd 69 3b 63 93 a0 e3 00 18 9c be 46 9f 50 2a 29 c8 c7 21 95 75 e6 29 0c af d5 04 dc 31 30 c8 51 36 WPA: RX message 1 of Group Key Handshake from ec:17:2f:60:45:a8 (ver=2) State: COMPLETED -> GROUP_HANDSHAKE WPA: Group Key - hexdump(len=16): [REMOVED] WPA: Installing GTK to the driver (keyidx=1 tx=0 len=16). WPA: RSC - hexdump(len=6): 00 00 00 00 00 00 wpa_driver_wext_set_key: alg=3 key_idx=1 set_tx=0 seq_len=6 key_len=16 WPA: Sending EAPOL-Key 2/2 WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f fe 03 12 00 10 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 1b a2 60 91 43 16 a4 df c0 98 62 84 85 bb 0f 00 00 WPA: Group rekeying completed with ec:17:2f:60:45:a8 [GTK=CCMP] Cancelling authentication timeout State: GROUP_HANDSHAKE -> COMPLETED
这个时候,你可以输入ifconfig查看,wlan0是否有数据流。
wlan0 Link encap:Ethernet HWaddr 48:02:2A:24:35:55 inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:85 errors:0 dropped:1 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:19029 (18.5 KiB) TX bytes:618 (618.0 B)
只要RX和TX有数据,不是0B。就代表成功了。欢呼吧。对了。接下来还有
第五步,将eth0 down掉,或者是改成别的IP段,反正不能跟wlan0在同一IP段。
[root@FriendlyARM /]# ifconfig eth0 down Ignore event for foreign ifindex 2 [root@FriendlyARM /]# ifconfig eth0 down [root@FriendlyARM /]# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:68 (68.0 B) TX bytes:68 (68.0 B) wlan0 Link encap:Ethernet HWaddr 48:02:2A:24:35:55 inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:128 errors:0 dropped:1 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:30244 (29.5 KiB) TX bytes:618 (618.0 B)
第六步,加路由.添加完,你可以试着ping网关。
route add default gw 192.168.1.1
[root@FriendlyARM /]# route add default gw 192.168.1.1 [root@FriendlyARM /]# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1): 56 data bytes 64 bytes from 192.168.1.1: seq=0 ttl=64 time=2173.410 ms 64 bytes from 192.168.1.1: seq=1 ttl=64 time=1247.833 ms 64 bytes from 192.168.1.1: seq=2 ttl=64 time=238.314 ms 64 bytes from 192.168.1.1: seq=3 ttl=64 time=123.821 ms 64 bytes from 192.168.1.1: seq=4 ttl=64 time=165.622 ms 64 bytes from 192.168.1.1: seq=5 ttl=64 time=209.468 ms 64 bytes from 192.168.1.1: seq=6 ttl=64 time=138.300 ms ^C --- 192.168.1.1 ping statistics --- 7 packets transmitted, 7 packets received, 0% packet loss round-trip min/avg/max = 123.821/613.824/2173.410 ms
第七步,ping外网
[root@FriendlyARM /]# ping www.baidu.com PING www.baidu.com (220.181.111.148): 56 data bytes 64 bytes from 220.181.111.148: seq=0 ttl=53 time=747.509 ms 64 bytes from 220.181.111.148: seq=1 ttl=53 time=320.500 ms 64 bytes from 220.181.111.148: seq=2 ttl=53 time=180.353 ms 64 bytes from 220.181.111.148: seq=3 ttl=53 time=64.297 ms 64 bytes from 220.181.111.148: seq=4 ttl=53 time=589.996 ms 64 bytes from 220.181.111.148: seq=5 ttl=53 time=656.760 ms 64 bytes from 220.181.111.148: seq=6 ttl=53 time=1066.557 ms 64 bytes from 220.181.111.148: seq=7 ttl=53 time=609.515 ms 64 bytes from 220.181.111.148: seq=8 ttl=53 time=144.448 ms
成功了。
当然这个只是一种情况下的连接,希望大家有什么建议或者想法都可以留言与我交流。谢谢
如果还是不行,可以考虑一下/etc/resov.conf这个文件。nameserver 192.168.1.1