Linux下無線網卡的安裝
用lsusb查看USB的安裝情況,如下圖使用yum安裝
已經成功安裝
進入到cd /lib/modules/2.6.32-431.el6.i686/kernel/drivers/net/ wimax/wireless/查看無線網卡版本
[root@host2 net]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 002: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
根據已有的驅動,把驅動拷到linux下
然後編譯安裝驅動
查看無線網卡有命令iwconfig
[root@host2 rtl]# iwconfig
-bash: iwconfig: command not found
提示沒有這個指令
需要安裝無線網卡工具
[root@host2 rtl]# cd /media/cdrom/Packages/
[root@host2 Packages]# ll |grep -i wireless
-r--r--r--. 2 root root 94584 Jul 3 2011 wireless-tools-29-5.1.1.el6.i686.rpm
-r--r--r--. 2 root root 95848 Jul 3 2011 wireless-tools-29-5.1.1.el6.x86_64.rpm
[root@host2 Packages]# yum install wireless -y
現在可以使用iwconfig查看無線網卡設置了
[root@host2~]# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 unassociated Nickname:"rtl_wifi"
Mode:Auto Access Point: Not-Associated Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/100 Signal level=0 dBm Noise level=0 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
無線網卡wlan0已經出現了
現在將我們的wlan0啓動
[root@host2 ~]# ifconfig wlan0 up
搜索無線網絡
[root@host2~]# iwlist wlan0 scanning
你會看到你附近能搜索的無線網列表
[root@host2 rtl3037]# iwlist wlan0 scanning
wlan0 Scan completed :
Cell 01 - Address: A8:57:4E:78:A4:02
ESSID:"NET-1"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.437 GHz (Channel 6)
Encryption key:on
Bit Rates:300 Mb/s
Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Extra:rsn_ie=30140100000fac040100000fac040100000fac020000
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD310050F204104A00011010440001021047001000000000000010000000A8574E78A402103C0001011049000600372A000120
Signal level=23/100
Cell 02 - Address: F8:D1:11:FB:F6:D4
ESSID:"php-1"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.437 GHz (Channel 6)
Encryption key:on
Bit Rates:300 Mb/s
Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Extra:rsn_ie=30140100000fac040100000fac040100000fac020000
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD0E0050F204104A0001101044000102
Signal level=23/100
到這一步已經可以找到無線網了
想要連接無線網還需要安裝一個wpa工具
進入系統光盤查看與wpa相關的軟件包
[root@host2 rtl3037]# cd /media/cdrom/Packages/
[root@host2 Packages]# ll |grep -i wpa_supplicant
-r--r--r--. 2 root root 374368 Feb 4 2013 wpa_supplicant-0.7.3-4.el6_3.i686.rpm
安裝這個軟件包來連接
[root@h2ost Packages]# yum install wpa_supplicant -y
安裝好後用 wpa_passphrase來設置無線網的名稱和密碼
格式是 wpa_passphrase <SSID> [password]
[root@host2 Packages]# wpa_passphrase NET-1
# reading passphrase from stdin
123!@#qaz
network={
ssid="NET-1"
#psk="123!@#qaz"
}
設置好後就可以連接了
連接用 wpa_supplicant 命令
[root@host2]# wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf
-B 後臺運行 -i 選擇網卡 -D wext -c 配置文件地址
動態獲得IP地址
[root@host2 Packages]# dhcpclient wlan0
編輯開機腳本
[root@lhost2 Packages]# vim /etc/rc.d/rc.local
在末尾添加以下3條命令
modprobe 3037u
wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpclient