Linux

配置無線網路

  • October 26, 2012

經過長時間的掙扎,我終於為我的無線網卡安裝了非免費無線韌體。我正在嘗試設置文件伺服器,因此我想將網路配置為靜態。你們中的一個人介意幫助我嗎?

例如,我不知道我的 /etc/network/interfaces 文件應該是什麼樣子,目前它看起來像這樣:

auto lo
iface lo inet loopback


allow-hotplug wlan1
iface wlan1 inet static
   address 192.168.10.111
   netmask 255.255.255.0
   network 192.168.10.0
   broadcast 192.168.10.255
   gateway 192.168.10.1
   # wireless-* options are implemented by the wireless-tools package
   wireless-mode managed
   wireless-essid Optimus Pwn
   wpa-psk s:roonwolf # I changed this from wiresless-key1 or something like that
   dns-* options are implemented by the resolvconf package, if installed
   dns-nameservers 192.168.10.1
   dns-search localdomain

我的 ifconfig 命令如下所示:

lo Link encap: Local Loopback
inet addr: 127.0.0.1 Mask: 255.0.0.0
inet6 addr: ::1/128 Scope: Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets: 95 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 95 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 0
RX bytes: 10376 (10.1KiB) TX bytes: 10376 (10.1 KiB)


wlan1 Link encap: Ethernet HWaddr 00:18:f3:85:99:07
inet addr:192.168.10.111 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier: 0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

這是我在 iwlist ssid 時得到的結果:

wlan1     Scan completed :
     Cell 01 - Address: 00:14:D1:A4:0A:36
               Channel:6
               Frequency:2.437 GHz (Channel 6)
               Quality=70/70  Signal level=-17 dBm  
               Encryption key:on
               ESSID:"Optimus Pwn"
               Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                         9 Mb/s; 12 Mb/s; 18 Mb/s
               Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
               Mode:Master
               Extra:tsf=00000003ff6381c1
               Extra: Last beacon: 100ms ago
               IE: Unknown: 000B4F7074696D75732050776E
               IE: Unknown: 010882848B960C121824
               IE: Unknown: 030106
               IE: Unknown: 0706555320010B1B
               IE: Unknown: 200100
               IE: WPA Version 1
                   Group Cipher : TKIP
                   Pairwise Ciphers (1) : TKIP
                   Authentication Suites (1) : PSK
               IE: Unknown: 2A0100
               IE: Unknown: 32043048606C
               IE: Unknown: DD180050F2020101070003A4000027A4000042435E0062322F00
               IE: Unknown: DD1E00904C334C101BFFFF000000000000000000000000000000000000000000
               IE: Unknown: 2D1A4C101BFFFF000000000000000000000000000000000000000000
               IE: Unknown: DD1A00904C3406001900000000000000000000000000000000000000
               IE: Unknown: 3D1606001900000000000000000000000000000000000000
               IE: Unknown: DD0900037F01010000FF7F

當我 ping 192.168.10.101(我的主桌面)時,我得到

PING 192.168.10.101 (192.168.10.101) 56(84) bytes of data.
From 192.168.10.111 icmp_seq=2 Destination Host Unreachable

當我 ping google.com 時,我得到(長時間停頓後):

ping: unknown host google.com

我在這裡到底做錯了什麼?我應該重新啟動網路嗎?

你試過網路管理器嗎?使用 GUI 為無線網路設置靜態 IP 很容易。一旦你在那里工作,如果你希望連接始終可用,即使你沒有登錄(例如對於文件伺服器),只需選擇“自動連接”和“對所有使用者可用”複選框。

如果您對 GUI 過敏,您可以通過在/etc/NetworkManager/system-connections/目錄中創建文件來配置連接,如本頁所述。

引用自:https://unix.stackexchange.com/questions/52991