advertisement

2016年2月19日

Linux 無線網路設定 安裝

若沒有iwconfig和iwlist指令時,安裝wireless-tools套件
root@tina:~# apt-get install wireless-tools

觀看是否有偵測到無線網路介面
root@tina:~# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

由上列結果發現沒有無線網路介面,可能沒有載入驅動模組或沒有安裝驅動程式,我們觀看電腦硬體資訊



root@tina:~# lspci <=觀看硬體資訊
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
01:00.0 Ethernet controller: Atheros Communications Inc. AR8131 Gigabit Ethernet (rev c0)
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 [Condor Peak]

無線網卡硬體資訊
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 [Condor Peak]

詢問Google大神後,發現Debian 已有套件可以安裝https://wiki.debian.org/iwlwifi

firmware-iwlwifi套件support以下devices:
Intel Wireless WiFi Link, Wireless-N, Advanced-N, Ultimate-N devices

安裝firmware-iwlwifi套件
root@tina:~# apt-get install firmware-iwlwifi
正在讀取套件清單... 完成
正在重建相依關係        
正在讀取狀態資料... 完成
無法取得套件 firmware-iwlwifi,但它卻被其它的套件引用了。
這意味著這個套件可能已經消失了、被廢棄了,或是只能由其他的來源取得

E: Package 'firmware-iwlwifi' has no installation candidate

從Debian套件資訊中發現套件被歸類在non-free中,所以我們要將鏡像站加入non-free才可下載該檔

這邊我使用vim來編輯鏡像站設定檔,我在鏡像站後面加入non-free
root@tina:~# vi /etc/apt/sources.list
#

# deb cdrom:[Debian GNU/Linux 7.8.0 _Wheezy_ - Official amd64 NETINST Binary-1 20150110-14:41]/ wheezy main

#deb cdrom:[Debian GNU/Linux 7.8.0 _Wheezy_ - Official amd64 NETINST Binary-1 20150110-14:41]/ wheezy main

deb http://opensource.nchc.org.tw/debian/ wheezy main non-free
deb-src http://opensource.nchc.org.tw/debian/ wheezy main non-free

deb http://security.debian.org/ wheezy/updates main non-free
deb-src http://security.debian.org/ wheezy/updates main non-free

# wheezy-updates, previously known as 'volatile'
deb http://opensource.nchc.org.tw/debian/ wheezy-updates main non-free
deb-src http://opensource.nchc.org.tw/debian/ wheezy-updates main non-free

更新套件
root@tina:~# apt-get update

安裝
root@tina:~# apt-get install firmware-iwlwifi
正在讀取套件清單... 完成
正在重建相依關係          
正在讀取狀態資料... 完成
下列【新】套件將會被安裝:
  firmware-iwlwifi
升級 0 個,新安裝 1 個,移除 0 個,有 0 個未被升級。
需要下載 3,579 kB 的套件檔。
此操作完成之後,會多佔用 7,399 kB 的磁碟空間。
下載:1 http://opensource.nchc.org.tw/debian/ wheezy/non-free firmware-iwlwifi all 0.36+wheezy.1 [3,579 kB]
取得 3,579 kB 用了 0s (4,482 kB/s)            
選取了原先未選的套件 firmware-iwlwifi。
(讀取資料庫 ... 目前共安裝了 133096 個檔案和目錄。)
解開 firmware-iwlwifi(從 .../firmware-iwlwifi_0.36+wheezy.1_all.deb)...
設定 firmware-iwlwifi (0.36+wheezy.1) ...


再次觀看wireless network interface
root@tina:~# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

還是沒有wireless network interface information ,可能沒有載入驅動模組
root@tina:~# modprobe -r iwlwifi ; modprobe iwlwifi
 modprobe -r 驅動模組  <=卸載模組
 modprobe 驅動模組  <=載入模組

root@tina:~# iwconfig 
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=14 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          
eth0      no wireless extensions.
我們可以看到無線網路介面資訊

手動設定網路-------
root@Lenovo-B480:~# vi /etc/network/interfaces

有線網路的部份前面要加上#註解
# The primary network interface
#auto eth0
#allow-hotplug eth0
#iface eth0 inet dhcp

確認你的無線連線機制是屬於WPA機制或是WEP機制(可以透過手機連線觀看或連至無線分享器介面觀看),並將適當的連線機制command填入 interfaces檔案內
# The wireless network interface
#WPA機制-------------------
auto eth1
iface eth1 inet dhcp
wpa-ssid 帳號
wpa-psk 密碼
#------------------------------

#WEP機制-------------------
auto eth1
iface eth1 inet dhcp
wireless-essid 帳號
wireless-key 密碼
#------------------------------


重啟網路
root@Lenovo-B480:~# /etc/init.d/networking restart
[warn] Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
[....] Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/c0:14:3d:c2:37:4f
Sending on   LPF/eth1/c0:14:3d:c2:37:4f
Sending on   Socket/fallback
DHCPRELEASE on eth1 to 192.168.0.1 port 67
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/c0:14:3d:c2:37:4f
Sending on   LPF/eth1/c0:14:3d:c2:37:4f
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth1 to 255.255.255.255 port 67
DHCPOFFER from 192.168.0.1
DHCPACK from 192.168.0.1
bound to 192.168.0.151 -- renewal in 38776 seconds.
done.

確認是否可以對外
root@Lenovo-B480:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=48 time=16.4 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=48 time=16.2 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=48 time=16.0 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 16.094/16.256/16.422/0.133 ms

使用NetworkManager視窗介面來設定網路

沒有留言:

張貼留言

文章有誤或有問題麻煩您留言告知! 謝謝您~~