网卡,在我们生活中经常使用到,CentOS安装和配置的工作就很重要,那么很多人不清楚应该如何安装和配置无线网卡,我们今天就来带大家一起了解下CentOS安装和配置无线网卡。
CentOS安装和配置无线网卡主要分几步:
1.下载无线网卡驱动程序;
2.安装无线网卡驱动程序;
3.配置无线拨号配置文件;
4.注意事项。
首先CentOS安装无线网卡
1,到http://snapshots.madwifi-project.org/madwifi-hal-0.10.5.6下载最新的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 240130
- scsi_dh117131 dm_multipath
- ath_rate_sample162561
- ath_pci 2308440
- wlan2037605 wlan_tkip,wlan_scan_sta,ath_rate_sample,ath_pci
- ath_hal 3056323 ath_rate_sample,ath_pci
- dm_mod 6220111 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 ~]$
即:网卡是否检测到、网卡驱动是否被系统识别、是否有错误信息等。
CentOS安装好之后,然后开始搜寻无线网络,如
- [simonsun@magic ~]$ /sbin/iwlist ath0 scan
- ath0Scan completed :
- Cell 01 - Address: 08:10:74:2B:C3:90
- ESSID:"NETCORE"
- Mode:Master
- Frequency:2.437 GHz (Channel 6)
- Quality=46/70Signal level=-49 dBmNoise 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/70Signal level=-72 dBmNoise 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/70Signal level=-78 dBmNoise 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/70Signal level=-83 dBmNoise 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/70Signal level=-80 dBmNoise 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/70Signal level=-84 dBmNoise 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/70Signal level=-78 dBmNoise 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/70Signal level=-88 dBmNoise 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
- ath0IEEE 802.11gESSID:"NETCORE"Nickname:"magic.linux"
- Mode:ManagedFrequency:2.437 GHzAccess 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/70Signal level=-48 dBmNoise level=-96 dBm
- Rx invalid nwid:38122Rx invalid crypt:0Rx invalid frag:0
- Tx excessive retries:0Invalid misc:0 Missed beacon:0
最后,激活配置好的无线网卡
- [simonsun@magic ~]$ sudo /sbin/ifconfig ath0 up
- [simonsun@magic ~]$ sudo /sbin/ifup ath0
- [simonsun@magic ~]$/sbin/ifconfig ath0
- ath0Link encap:EthernetHWaddr 00:22:43:2D:AE:2B
- inet addr:192.168.0.152Bcast:192.168.0.255Mask:255.255.255.0
- inet6 addr: fe80::222:43ff:fe2d:ae2b/64 Scope:Link
- UP BROADCAST RUNNING MULTICASTMTU:1500Metric: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
这样,我们就完成了CentOS安装和配置无线网卡的工作。
【编辑推荐】