感谢支持
我们一直在努力

Fedora 17 x64 连接wpa加密的无线路由器

版本
[root@www.linuxidc.com ~]# 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
[root@www.linuxidc.com ~]#

列出所有已连接的网卡
[root@www.linuxidc.com ~]# 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)
[root@www.linuxidc.com ~]#

找出无线网卡的设备ID(device id)
[root@www.linuxidc.com ~]# lspci -n | grep 03:00.0
03:00.0 0280: 10ec:8176 (rev 01)
[root@www.linuxidc.com ~]#

找出无线网卡的驱动
[root@www.linuxidc.com ~]# 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

[root@www.linuxidc.com ~]#

查看无线网卡内核驱动是否已经加载
[root@www.linuxidc.com ~]# lsmod | grep rtl8192ce
rtl8192ce              79523  0
rtlwifi              104879  1 rtl8192ce
rtl8192c_common        72193  1 rtl8192ce
mac80211              492420  3 rtl8192c_common,rtlwifi,rtl8192ce
[root@www.linuxidc.com ~]#

查看无线网卡在系统中显示的名称
[root@www.linuxidc.com ~]# dmesg | grep rtl8192ce
[root@www.linuxidc.com ~]# 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)
[root@www.linuxidc.com ~]#

查看并启动无线网卡
[root@www.linuxidc.com ~]# 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
[root@www.linuxidc.com ~]# ip link set wlan0 up
[root@www.linuxidc.com ~]# 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
[root@www.linuxidc.com ~]#

列出附近所有无线的SSID
[root@www.linuxidc.com ~]# iw dev wlan0 scan | grep -i ssid
    SSID: n13u
    SSID: Tenda_3F97F8
    SSID: 106F3F380F0F
    SSID: FAST_Diablo
[root@www.linuxidc.com ~]#

为需要连接的无线路由/SSID生成密码wpa加密密码,并写入配置文件
[root@www.linuxidc.com ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

[root@www.linuxidc.com ~]# wpa_passphrase n13u ‘!#12345678901’ >> /etc/wpa_supplicant/wpa_supplicant.conf
[root@www.linuxidc.com ~]# cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
    ssid=”n13u”
    #psk=”!#12345678901″
    psk=b8322c53a992106fdf862b3b31dc8235ab4d89795efa233b7c3f946711fdfcd9
}
[root@www.linuxidc.com ~]#

以调试模式验证密码
[root@www.linuxidc.com ~]# wpa_supplicant -h | tail -n 1
  wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
[root@www.linuxidc.com ~]# 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]

调试模式验证成功后,用接下来的命令为验证开启一个后台进程
[root@www.linuxidc.com ~]# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
[root@www.linuxidc.com ~]#

申请一个dhcp IP地址
[root@www.linuxidc.com ~]# dhclient wlan0
[root@www.linuxidc.com ~]#

[root@www.linuxidc.com ~]# 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
[root@www.linuxidc.com ~]#

[root@www.linuxidc.com ~]# 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

[root@www.linuxidc.com ~]#

已经可以上网了
[root@www.linuxidc.com ~]# 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
[root@www.linuxidc.com ~]#

赞(0) 打赏
转载请注明出处:服务器评测 » Fedora 17 x64 连接wpa加密的无线路由器
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏