Ubuntu 無線網卡配置文件說明

     

ubuntu 終端下配置無線網卡  

                   2009-11-30 16:26:48|  分類:          Ubuntu                          |舉報        |字號 訂閱      

轉貼:http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=245226&start=0

注意:這個只是配置的教程,如果在無線網卡未被識別及驅動下不適用

測試環境: ubuntu 9.10 Server  +  D-LINK DWL-G520+A

###########/etc/network/interfaces###########

# The loopback network interface

auto lo
iface lo inet loopback

# The primary network interface

auto eth0 # or allow-hotplug eth0
iface eth0 inet static # or dhcp
hwaddress ether xx:xx:xx:xx:xx:xx
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx

# The wireless network interface

auto wlan0 # or allow-hotplug wlan0
iface wlan0 inet static # or dhcp
hwaddress ether xx:xx:xx:xx:xx:xx
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx
#WEP
wireless-essid xxxx
wireless-keymode open|restricted
wireless-key 12345|s:ascii
#WPA
wpa-ssid xxxx
wpa-driver wext
wpa-psk plaintext|hexadecimal

###############/etc/resolv.conf###############

# OpenDNS

nameserver 208.67.222.222
nameserver 208.67.220.220

##################MAC-Change##################

sudo ifconfig eth0 down

sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

sudo ifconfig eth0 up

############Make it in operation#############

sudo /etc/init.d/networking restart

############Manual wired operation#############

ifconfig eth0 up

#DHCP

dhclient eth0

#Static

ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0

route add default gw xxx.xxx.xxx.xxx

##########Manual wireless operation###########


ifconfig wlan0 up

iwlist wlan0 scan

#No encryption

iwconfig wlan0 essid "ssid"

#WEP

iwconfig wlan0 essid "ssid" key 1234567890

iwconfig wlan0 essid "ssid" key s:asciikey

#WPA/WPA2

wpa_passphrase [ssid] [passphrase] >> /etc/wpa_supplicant.conf

wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

#DHCP

dhclient wlan0

#Static

ifconfig wlan0 xxx.xxx.xxx.xxx netmask 255.255.255.0

route add default gw xxx.xxx.xxx.xxx

----------  以下是本人自己的記錄 ----------
在安裝完系統後,系統已經能驅動 D-LINK DWL-G520+A 了,只需按以下配置一下即下連接上AP
確認AP的加密設置爲:
     模式:WPA Personal
     算法:TKIP

1) 先用 ifconfig -a 命令 show 一下網卡的設備號,一般第一張無線網卡爲 wlan0
2) 在 /etc/network/interface 最後面加入
        auto wlan0                                         <-- 這裏填入上面ifconfig -a查看到的設備號
        iface wlan0 inet dhcp                          <-- 這裏可以用DHCP自動分配IP地址,也可以用static來自定義IP地址
        wpa-ssid xxxx                                    <--這裏xxxx是你AP上設備的SSID ,注意大小寫
        wpa-driver wext                                   <--告訴系統你用什麼驅動,具體可問 google
        wpa-psk plaintext|hexadecimal             <-- 這裏填你爲無線AP設置好的密碼,不是無線路由器的管理密碼喔

如果無線AP的加密設置爲:
     模式:WPA2 Personal
     算法:TKIP
    
     配置文件同上面的一樣

     運行一下以下指令:
         wpa_passphrase [ssid] [passphrase] >> /etc/wpa_supplicant.conf
         wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf



如果不使用DHCP自動分配IP地址:

1)vi /etc/resolv.conf
2)加入兩個ISP的DNS服務IP地址:
     nameserver 202.96.128.86
     nameserver 202.96.128.166
     [ 以上兩個IP都是廣東電信的DNS]


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章