有一块古老的贝尔金pci无线网卡,芯片是AR2413/AR2414:
[root@bw-control network-scripts]# lspci
...
11:00.0 Ethernet controller: Atheros Communications Inc. AR2413/AR2414 Wireless Network Adapter [AR5005G(S) 802.11bg] (rev 01)
...
好在centos5.8能认出来,并自动加载了ath5k驱动
[root@bw-control network-scripts]# dmesg | grep ath5k
ath5k 0000:11:00.0: registered as 'phy0'
ath5k phy0: Atheros AR2413 chip found (MAC: 0x78, PHY: 0x45)
因此该无线网卡可以在centos5中使用
[root@bw-control network-scripts]# ifup wlan0
[root@bw-control network-scripts]# iwlan wlan0 scan
通过该命令可找到欲附着的AP ssid
接着通过wpa_passphase生成基本的配置文件
[root@bw-control network-scripts]# wpa_passphase jk_hangye <passphase> > /etc/sysconfig/network-scripts/wpa.conf
然后通过wpa_supplicant附着到AP
[root@bw-control network-scripts]# wpa_supplicant -Dwext -iwlan0 -cwpa.conf
(wext) Device wlan0 kernel driver name: ath5k.
Device wlan0 kernel driver name: ath5k.
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 4 value 0x0 - Trying to associate with c8:d3:a3:32:ba:96 (SSID='jk_hangye' fr
eq=2457 MHz)
Associated with c8:d3:a3:32:ba:96
WPA: Key negotiation completed with c8:d3:a3:32:ba:96 [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to c8:d3:a3:32:ba:96 completed (auth) [id=0 id_str=]
看似有问题,实则OK
[root@bw-control network-scripts]# dmesg | less
...
ADDRCONF(NETDEV_UP): wlan0: link is not ready
wlan0: direct probe to AP c8:d3:a3:32:ba:96 (try 1)
wlan0: deauthenticating from c8:d3:a3:32:ba:96 by local choice (reason=3)
wlan0: direct probe to AP c8:d3:a3:32:ba:96 (try 1)
wlan0: direct probe to AP c8:d3:a3:32:ba:96 (try 2)
wlan0: direct probe responded
wlan0: authenticate with AP c8:d3:a3:32:ba:96 (try 1)
wlan0: authenticated
wlan0: associate with AP c8:d3:a3:32:ba:96 (try 1)
wlan0: RX AssocResp from c8:d3:a3:32:ba:96 (capab=0x431 status=0 aid=6)
wlan0: associated
ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
padlock: VIA PadLock not detected.
wlan0: no IPv6 routers present
...
需要注意的事,wpa_supplicant只是将无线网卡附着到AP,并通过wpa1/2的认证,dhcp尚未开启,因此还需要:
[root@bw-control network-scripts]# dhclient wlan0
Internet Systems Consortium DHCP Client V3.0.5-RedHat
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit
http://www.isc.org/sw/dhcp/Listening on LPF/wlan0/00:11:50:d3:bd:93
Sending on LPF/wlan0/00:11:50:d3:bd:93
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7 (xid=0x40a739ed)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10 (xid=0x40a739ed)
DHCPOFFER from 192.168.1.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67 (xid=0x40a739ed)
DHCPACK from 192.168.1.1 (xid=0x40a739ed)
bound to 192.168.1.106 -- renewal in 39511 seconds.
从而获得IP地址,实现无线网卡的完整接入。