安裝Linux測試機又不想牽線,只好來實驗一下安裝無線網卡,將不使用Network manager
範例:
OS: CentOS 6.5 minimal
Wireless card: RT73 chip
AP SSID: shazi
準備套件: iw , wpa_supplicant , linux-firmware , dhcp3-client
套件安裝
安裝RT73 driver
1. 安裝firmware的repo , elrepo
shell# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
2. yum install wi (Wireless tools)
3. install RT73 firmware
shell# yum --enablerepo=elrepo install rt73usb-firmware
檢查是否載入RT73
shell# lsmod | grep rt73
找到rt37 use message
shell# iwconfig
找到無線網卡wlan0
設定
SETP.1 編輯ifcfg-wlan0
shell# vim/etc/sysconfig/network-scripts/ifcfg-wlan0
TYPE=Wireless WPA=yes ONBOOT=yes
因為我的AP有WPA2的加密認證,所以要使用wpa_supplicant來處理WPA
SETP.2 產生wpa_supplicant.conf 所需要的psk金鑰加密
shell# wpa_passphrase shazi password
ex:
network={ ssid="shazi" #psk="password" psk=7e5ca53c4a8ad04b8a3962d0e0b84ad584660c5fc2542bcef1d178fac85 }
SETP.3 將wpa_passphrase產生的金鑰加入wpa_supplicant.conf
shell# vim /etc/wpa_supplicant/wpa_supplicant.conf
ex:
ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=wheel network={ ssid="shazi" #psk="password" psk=7e5ca53c4a8ad04b8a3962d0e0b84ad584660c5fc2542bcef1d178fac85 }
SETP.4 綁定wpa_supplicant使用的網卡
shell# vim /etc/sysconfig/wpa_supplicant
ex:
INTERFACES="-iwlan0" DRIVERS="-Dwext"
Connect Test Case:
1. wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
messag: Connection to mac is completed , but need stop use Ctrl+C
2. iw dev wlan0 connect shazi
3. ifconfig wlan0 up
4. check reboot is OK.
if you not get the IP , maybe not open dhclient.
ex:
shell# dhclient
or
shell# vim /etc/sysconfig/network-scripts/ifcfg-wlan0
BOOTPROTO=dhcp
參考: