版本
[[email protected] ~]# uname -a
Linux tp 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]#
列出所有已連接的網卡
[[email protected] ~]# lspci -v | grep Net
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)
[[email protected] ~]#
找出無線網卡的設備ID(device id)
[[email protected] ~]# lspci -n | grep 03:00.0
03:00.0 0280: 10ec:8176 (rev 01)
[[email protected] ~]#
找出無線網卡的驅動
[[email protected] ~]# lspci -vd 10ec:8176
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)
Subsystem: Realtek Semiconductor Co., Ltd. Device 8195
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at 5000 [size=256]
Memory at f2500000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00
Kernel driver in use: rtl8192ce
[[email protected] ~]#
查看無線網卡內核驅動是否已經加載
[[email protected] ~]# lsmod | grep rtl8192ce
rtl8192ce 79523 0
rtlwifi 104879 1 rtl8192ce
rtl8192c_common 72193 1 rtl8192ce
mac80211 492420 3 rtl8192c_common,rtlwifi,rtl8192ce
[[email protected] ~]#
查看無線網卡在系統中顯示的名稱
[[email protected] ~]# dmesg | grep rtl8192ce
[[email protected] ~]# cat /var/log/messages | grep rtl8192ce
Nov 25 21:48:49 tp NetworkManager[664]: <info> (wlan0): new 802.11 WiFi device (driver: 'rtl8192ce' ifindex: 3)
[[email protected] ~]#
查看並啟動無線網卡
[[email protected] ~]# ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
link/ether 60:d8:19:cc:74:84 brd ff:ff:ff:ff:ff:ff
[[email protected] ~]# ip link set wlan0 up
[[email protected] ~]# ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
link/ether 60:d8:19:cc:74:84 brd ff:ff:ff:ff:ff:ff
[[email protected] ~]#
列出附近所有無線的SSID
[[email protected] ~]# iw dev wlan0 scan | grep -i ssid
SSID: n13u
SSID: Tenda_3F97F8
SSID: 106F3F380F0F
SSID: FAST_Diablo
[[email protected] ~]#
為需要連接的無線路由/SSID生成密碼wpa加密密碼,並寫入配置文件
[[email protected] ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
[[email protected] ~]# wpa_passphrase n13u '!#12345678901' >> /etc/wpa_supplicant/wpa_supplicant.conf
[[email protected] ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="n13u"
#psk="!#12345678901"
psk=b8322c53a992106fdf862b3b31dc8235ab4d89795efa233b7c3f946711fdfcd9
}
[[email protected] ~]#
以調試模式驗證密碼
[[email protected] ~]# wpa_supplicant -h | tail -n 1
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
[[email protected] ~]# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d
wpa_supplicant v1.0-rc3
random: Trying to read entropy from /dev/random
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'
...
wpa_driver_wext_set_key: alg=3 key_idx=1 set_tx=0 seq_len=6 key_len=16
wlan0: WPA: Key negotiation completed with bc:ae:c5:7e:ba:fc [PTK=CCMP GTK=CCMP]
wlan0: Cancelling authentication timeout
wlan0: State: GROUP_HANDSHAKE -> COMPLETED
wlan0: CTRL-EVENT-CONNECTED - Connection to bc:ae:c5:7e:ba:fc completed (auth) [id=0 id_str=]
wpa_driver_wext_set_operstate: operstate 0->1 (UP)
netlink: 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: Supplicant port status: Authorized
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
WEXT: if_removed already cleared - ignore event
EAPOL: startWhen --> 0
EAPOL: disable timer tick
看到下面這句說明密碼驗證成功了
wlan0: WPA: Key negotiation completed with bc:ae:c5:7e:ba:fc [PTK=CCMP GTK=CCMP]
調試模式驗證成功後,用接下來的命令為驗證開啟一個後台進程
[[email protected] ~]# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
[[email protected] ~]#
申請一個dhcp IP地址
[[email protected] ~]# dhclient wlan0
[[email protected] ~]#
[[email protected] ~]# ip addr show wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 60:d8:19:cc:74:84 brd ff:ff:ff:ff:ff:ff
inet 192.168.168.118/24 brd 192.168.168.255 scope global wlan0
inet6 fe80::62d8:19ff:fecc:7484/64 scope link
valid_lft forever preferred_lft forever
[[email protected] ~]#
[[email protected] ~]# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.168.118 netmask 255.255.255.0 broadcast 192.168.168.255
inet6 fe80::62d8:19ff:fecc:7484 prefixlen 64 scopeid 0x20<link>
ether 60:d8:19:cc:74:84 txqueuelen 1000 (Ethernet)
RX packets 98 bytes 10981 (10.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 114 bytes 19307 (18.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[[email protected] ~]#
已經可以上網了
[[email protected] ~]# ping -c 1 g.cn
PING g.cn (74.125.128.160) 56(84) bytes of data.
64 bytes from hg-in-f160.1e100.net (74.125.128.160): icmp_req=1 ttl=39 time=532 ms
--- g.cn ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 532.026/532.026/532.026/0.000 ms
[[email protected] ~]#