2014年12月30日 星期二

手動無線網路 wlan0 連線


說明:

這邊介紹 iwconfig 的手動連線方法,
其中一點要注意的是,它不支援 WPA 加密格式
它只適用 WEP 加密處理,因此以本校 STUST 為例是適用的!

壹。手動 iwconfig 無線網路設定

一、清除網路設定

1. 有線網路 eth0 清除

route del default eth0
ifconfig eth0 down

順便補充無線網路 wlan0 清除:
ifconfig wlan0 down
iwconfig wlan0 txpower off

二、 開啟無線網路

iwconfig wlan0 txpower on
ifconfig wlan0 up

三、掃描可用的無線 AP 站

iwlist wlan0 scan | grep -i essid

輸出如下:
                    ESSID:"Alias 4G"
                    ESSID:"stust_p203"
                    ESSID:"stust_p205"
                    ESSID:"EDIMAX"
                    ESSID:"S611-AP"
                    ESSID:"stust_p306"
                    ESSID:"S210B"
                    ESSID:"stust_teacher"
                    ESSID:"stust_p302"
                    ESSID:"stust_j304"
                    ESSID:"stust_teacher"
                    ESSID:"stust_s412@"
                    ESSID:"stust_teacher"
                    ESSID:"stust_p503"
                    ESSID:"stust_teacher"
                    ESSID:"stust_s314"
                    ESSID:"stust_j402"
                    ESSID:"stust_s414"
                    ESSID:"stust_s514"
                    ESSID:"p501_PM"

四、設定 ESSID

假設要連線上面掃到的 ESSID:"stust_p203"
iwconfig wlan0 essid stust_p503

檢查 ESSID 設定:
iwconfig wlan0

五、取得 IP

dhclient -v wlan0

成功取得後,即可得到 AP 所發出來的 ip !

--------------------------------------------------------------------------------

貳。修改網路設定檔 (可支援 WPA 加密格式 )

一、同上面方式清除 eth0,開啟 wlan0

1. 有線網路 eth0 清除

route del default eth0
ifconfig eth0 down

2. 開啟無線網路

iwconfig wlan0 txpower on
ifconfig wlan0 up

二、修改設定檔

vi /etc/network/interfaces

加入下面設定 (原本的網路不變動,或用 # 註解掉)
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "AP-ESSID"
wpa-psk "password"

三、重啟網路

/etc/init.d/networking restart

service networking restart

四、查看有無找到 ip

ifconfig














沒有留言:

張貼留言