1.下载无线网卡驱动程序;
2.安装无线网卡驱动程序;
3.配置无线拨号配置文件;
4.注意事项和备注。
1, 到http://snapshots.madwifi-project.org下载最新的madwifi- hal-0.10.5.6文件,如madwifi-hal-0.10.5.6-r4016-20090429.tar.gz;
2,解压后.gz文件后用make && make install编译安装,最好从新启动一下系统;
3,确保下列类似信息的存在:[simonsun@magic ~]$ /sbin/lspci | grep Ethernet
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
06:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
[simonsun@magic ~]$ dmesg | grep "HAL"
[simonsun@magic ~]$ /sbin/lsmod | grep ath
dm_multipath 24013 0
scsi_dh 11713 1 dm_multipath
ath_rate_sample 16256 1
ath_pci 230844 0
wlan 203760 5 wlan_tkip,wlan_scan_sta,ath_rate_sample,ath_pci
ath_hal 305632 3 ath_rate_sample,ath_pci
dm_mod 62201 11 dm_multipath,dm_raid45,dm_snapshot,dm_zero,dm_mirror,dm_log
[simonsun@magic ~]$ /sbin/iwlist
Usage: iwlist [interface] scanning
[interface] frequency
[interface] channel
[interface] bitrate
[interface] rate
[interface] encryption
[interface] key
[interface] power
[interface] txpower
[interface] retry
[interface] ap
[interface] accesspoints
[interface] peers
[interface] event
[simonsun@magic ~]$
即:网卡是否检测到、网卡驱动是否被系统识别、是否有错误信息等。
然后开始搜寻无线网络,如
[simonsun@magic ~]$ /sbin/iwlist ath0 scan
ath0 Scan completed :
Cell 01 - Address: 08:10:74:2B:C3:90
ESSID:"NETCORE"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=46/70 Signal level=-49 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Cell 02 - Address: 00:22:B0:91:5B:D1
ESSID:"dlink-starsing"
Mode:Master
Frequency:2.417 GHz (Channel 2)
Quality=23/70 Signal level=-72 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
Extra:ath_ie=dd0900037f01010060ff7f
Cell 03 - Address: 00:19:E0:AD:B1:5E
ESSID:"TP-LINK"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=17/70 Signal level=-78 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:ath_ie=dd0900037f01010008ff7f
Cell 04 - Address: 00:21:27:BA:63:A2
ESSID:"TP-LINK_BA63A0"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=12/70 Signal level=-83 dBm Noise level=-95 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:wme_ie=dd180050f2020101030003a4000027a4000042435e0062322f00
Extra:ath_ie=dd0900037f01010000ff7f
Cell 05 - Address: 00:B0:0C:04:C4:D2
ESSID:"TENDA"
Mode:Master
Frequency:2.452 GHz (Channel 9)
Quality=15/70 Signal level=-80 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Cell 06 - Address: 00:23:CD:36:D3:C4
ESSID:"TP-LINK_36D3C4"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=11/70 Signal level=-84 dBm Noise level=-95 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:ath_ie=dd0900037f01010008ff7f
Cell 07 - Address: 00:B0:0C:03:B0:64
ESSID:"Tenda"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=17/70 Signal level=-78 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
18 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 12 Mb/s
24 Mb/s; 48 Mb/s
Extra:bcn_int=100
Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00
Cell 08 - Address: 00:1B:11:8C:3B:8C
ESSID:"dlink"
Mode:Master
Frequency:2.462 GHz (Channel 11)
Quality=7/70 Signal level=-88 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 48 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 54 Mb/s
Extra:bcn_int=100
根据实际情况编辑如下文件,或者通过system-config-network的图形化界面配置,
[simonsun@magic ~]$ sudo vim /etc/sysconfig/network-scripts/ifcfg-ath0
# Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter
DEVICE=ath0
BOOTPROTO=none
ONBOOT=no
HWADDR=00:22:43:2d:ae:2b
NETMASK=255.255.255.0
DHCP_HOSTNAME=
IPADDR=192.168.0.152
DOMAIN=
TYPE=Wireless
ESSID=NETCORE
CHANNEL=
MODE=Managed
SECURITYMODE=off
RATE=auto
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=192.168.0.1
配好会有:
[simonsun@magic ~]$ /sbin/iwconfig ath0
ath0 IEEE 802.11g ESSID:"NETCORE" Nickname:"magic.linux"
Mode:Managed Frequency:2.437 GHz Access Point: 08:10:74:2B:C3:90
Bit Rate:48 Mb/s Tx-Power:17 dBm Sensitivity=1/1
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=48/70 Signal level=-48 dBm Noise level=-96 dBm
Rx invalid nwid:38122 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
最后,激活配置好的无线网卡,
[simonsun@magic ~]$ sudo /sbin/ifconfig ath0 up
[simonsun@magic ~]$ sudo /sbin/ifup ath0
[simonsun@magic ~]$ /sbin/ifconfig ath0
ath0 Link encap:Ethernet HWaddr 00:22:43:2D:AE:2B
inet addr:192.168.0.152 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::222:43ff:fe2d:ae2b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:106106 errors:0 dropped:0 overruns:0 frame.:0
TX packets:30806 errors:1 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:140732082 (134.2 MiB) TX bytes:1976717 (1.8 MiB)
[simonsun@magic ~]$ ping www.google.com
PING www-china.l.google.com (66.249.89.99) 56(84) bytes of data.
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=1 ttl=246 time=67.1 ms
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=2 ttl=246 time=65.3 ms
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=3 ttl=246 time=66.4 ms
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=4 ttl=246 time=65.8 ms
--- www-china.l.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 65.352/66.205/67.137/0.714 ms
[simonsun@magic ~]$
4.注意事项,一般需要设置DNS,不要忘了;如果是根据mac地址限制网络使用的话,一定要将无线网卡的mac地址正确的添加到路由器;如果连接模式通过WPA-PSK进行加密登录的话,就需要用到wpa_supplicant:
[simonsun@magic ~]$ sudo yum install \*wpa\*
[simonsun@magic ~]$ /usr/sbin/wpa_passphrase NETCORE 123456781
network={
ssid="NETCORE"
#psk="123456781"
psk=21135846dce955a6319561d7216a1407d1cb97b8fb339c05f8773a3f780d6663
}
[simonsun@magic ~]$ sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
修改如下:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
#network={
# ssid="any"
# key_mgmt=NONE
#}
network={
ssid="NETCORE"
#psk="123456781"
psk=21135846dce955a6319561d7216a1407d1cb97b8fb339c05f8773a3f780d6663
}
[simonsun@magic ~]$ sudo vim /etc/sysconfig/wpa_supplicant
修改INTERFACES为前面装好驱动后识别的网卡,如ath0,我这里是:
# Use the flag "-i" before each of your interfaces, like so:
# INTERFACES="-i eth1 -i wlan0"
INTERFACES="-i ath0"
# Use the flag "-D" before each driver, like so:
# DRIVERS="-D wext"
DRIVERS="-D wext"
# Other arguments
# -u Enable the D-Bus interface (required for use with NetworkManager)
# -f Log to /var/log/wpa_supplicant.log
OTHER_ARGS="-u -f /var/log/wpa_supplicant.log"
,然后启动wpa服务,
[simonsun@magic ~]$ sudo /etc/rc.d/init.d/wpa_supplicant start
Starting wpa_supplicant: /etc/wpa_supplicant/wpa_supplicant[确定]-i ath0 -D wext -u -f /var/log/wpa_supplicant.log
,然后拨号,平时上网,只执行如下脚本即可
sudo /sbin/ifconfig ath0 up
sudo /sbin/ifdown ath0
sudo /sbin/ifup ath0
sudo /etc/rc.d/init.d/wpa_supplicant restart
sudo /etc/rc.d/init.d/iptables restart
参考连接:
http://wiki.centos.org/HowTos/Laptops/WirelessAR5007EG
http://hi.baidu.com/netred/blog/item/6d7f061f708b8ccfa786691e.html
BTW,特别鸣谢秦公子网络环境方面的帮助。
2009-06-22,如果系统内核升级了,必须重新编译一下驱动,再次配置。
2011-07-11,现在CentOS 6 系列能自动识别大部分无线网卡了,一般不用像上面那么费劲的配置了 :) .
备注:
如果SSID名字改了,须要重新修改无线网络配置里的无线设置的网络名称的指定的,同时必须 (千万别忘了)重新生成一下密码钥匙,即:用/usr/sbin/wpa_passphrase 新名字 新密码,然后再次拨号即可。
其实最合理的是,从新建一个无线拨号连接,当然也得重新生成一下密码钥匙,添加到/etc/wpa_supplicant/wpa_supplicant.conf里。
附最新的Windows的无线网卡驱动,关于Atheros Communications Inc. AR5XXX Wireless Windows下的驱动。