Ubuntu 12.04 + Wifi 无法正常工作

Ubuntu 12.04 + Wifi 无法正常工作

我在无线连接方面遇到了问题。目前,我正在使用 wicd。它似乎卡在“验证 AP 关联...”上。没有 wicd,我可以建立连接并 ping 网络 - 但是如果我关闭 eth0(ifconfig eth0 down),我的无线也会消失(如果我拔掉电线,结果是一样的)。wicd 是我恢复 eth0 的唯一方法(这是我使用它的主要原因)- ifconfig eth0 和/或 ifup eth0 不会重新启用连接(我刚发现它遗漏了网关。重新添加网关会重新启用包括 wifi 在内的连接;我不想删除上面关于 wicd 的信息,以防它给别人一个想法。)

尽管存在错误(如果能解决就好了),但手动执行仍然允许我 ping 外部世界:

ifup wlan0

ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ssh stop/waiting
ssh start/running, process 17336

ping -I wlan0 -c 4 8.8.8.8

PING 8.8.8.8 (8.8.8.8) from 192.168.0.12 wlan0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=43 time=48.8 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=43 time=47.9 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=48.7 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=43 time=53.2 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 47.975/49.711/53.235/2.063 ms

# iw配置

lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"TPLINK"  
      Mode:Managed  Frequency:2.427 GHz  Access Point: 64:66:xx:xx:xx:22   
      Bit Rate=108 Mb/s   Tx-Power=27 dBm   
      Retry  long limit:7   RTS thr:off   Fragment thr:off
      Encryption key:off
      Power Management:off
      Link Quality=70/70  Signal level=-39 dBm  
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:3   Missed beacon:0
 bus info: pci@0000:03:00.0
   logical name: wlan0
   version: 01
   serial: f0:7d:68:c1:b4:13
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
   configuration: broadcast=yes driver=ath9k driverversion=3.2.0-67-generic-pae firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11bgn
   resources: irq:17 memory:dfbf0000-dfbfffff

路由

default via 192.168.0.1 dev eth0 
default via 192.168.0.1 dev wlan0  metric 100 
169.254.0.0/16 dev wlan0  scope link  metric 1000 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.102 
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.12

(据记录,我不知道 169.254.0.0 地址在那里做什么。)

uname -a

3.2.0-67-generic-pae #101-Ubuntu SMP Tue Jul 15 18:04:54 UTC 2014 i686 i686 i386 GNU/Linux

lshw-C 网络

  *-network               
   description: Ethernet interface
   product: NetXtreme BCM5751 Gigabit Ethernet PCI Express
   vendor: Broadcom Corporation
   physical id: 0
   bus info: pci@0000:02:00.0
   logical name: eth0
   version: 01
   serial: 00:11:11:59:fc:09
   size: 100Mbit/s
   capacity: 1Gbit/s
   width: 64 bits
   clock: 33MHz
   capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
   configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.121 duplex=full firmware=5751-v3.23a ip=192.168.0.102 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
   resources: irq:16 memory:dfcf0000-dfcfffff
  *-network
   description: Wireless interface
   product: AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn] (PCI-Express)
   vendor: Qualcomm Atheros
   physical id: 0

/etc/网络/接口

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

source /etc/network/interfaces.eth0
source /etc/network/interfaces.wlan0

/etc/network/interfaces.eth0

#Main Interface
auto eth0
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
gateway 192.168.0.1

/etc/network/interfaces.wlan0

auto wlan0 
iface wlan0 inet static
address 192.168.0.12
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8
netmask 255.255.255.0
wpa-driver wext
wpa-ssid TPLINK
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk dca1badb5fd4e9axxx4xxdaaxxfa91xx610bxx6a7d57ef67af9809dxx6af42e39

/etc/wpa_supplicant.conf

    ctrl_interface=/var/run/wpa_supplicant

network={
    ssid="TPLINK"
    psk="my password"
    key_mgmt=WPA-PSK
    proto=RSN
    pairwise=CCMP
    group=CCMP
}

ifdown: interface eth0 not configured

是否配置

eth0      Link encap:Ethernet  HWaddr 00:11:xx:xx:xx:09  
          inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::211:11ff:fe59:fc09/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:213690 errors:0 dropped:0 overruns:0 frame:0
          TX packets:155266 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:220057808 (220.0 MB)  TX bytes:21137696 (21.1 MB)
          Interrupt:16 

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:196412 errors:0 dropped:0 overruns:0 frame:0
          TX packets:196412 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:153270697 (153.2 MB)  TX bytes:153270697 (153.2 MB)

wlan0     Link encap:Ethernet  HWaddr f0:7d:xx:xx:xx:13  
          inet addr:192.168.0.12  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::f27d:68ff:fec1:b413/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11335 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7287 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2563290 (2.5 MB)  TX bytes:855746 (855.7 KB)

ifconfig eth0 关闭

是否配置

eth0      Link encap:Ethernet  HWaddr 00:xx:xx:xx:xx:09  
          inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::211:11ff:fe59:fc09/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:192 (192.0 B)  TX bytes:94 (94.0 B)
          Interrupt:16 

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:196418 errors:0 dropped:0 overruns:0 frame:0
          TX packets:196418 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:153270871 (153.2 MB)  TX bytes:153270871 (153.2 MB)

wlan0     Link encap:Ethernet  HWaddr f0:7d:xx:xx:xx:13  
          inet addr:192.168.0.12  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::f27d:68ff:fec1:b413/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11359 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7293 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2565482 (2.5 MB)  TX bytes:856363 (856.3 KB)

路由

default via 192.168.0.1 dev wlan0  metric 100 
169.254.0.0/16 dev wlan0  scope link  metric 1000 
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.12 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.102 

ping -I wlan0 -c 4 8.8.8.8

PING 8.8.8.8 (8.8.8.8) from 192.168.0.12 wlan0: 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3024ms

ping -I eth0 -c 3 路由器

PING router (192.168.0.1) from 192.168.0.102 eth0: 56(84) bytes of data.

--- router ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2015ms

ping -I wlan0 -c 3 路由器

PING router (192.168.0.1) from 192.168.0.12 wlan0: 56(84) bytes of data.

--- router ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2014ms

如果您需要更多信息,请告诉我。

先感谢您。

# #

结果:

ifup wlan0
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
RTNETLINK answers: File exists
Failed to bring up wlan0.

因此我终止了 wpa_supplicant (使用 SIGHUP)并重新运行ifup wlan0

RTNETLINK answers: File exists
Failed to bring up wlan0.

系统日志显示:wpa_supplicant[13626]: Failed to initiate AP scan

wpa_supplicant[13626]: message repeated 409 times: [ Failed to initiate AP scan.]

ps -ef | grep wpa
root 13626 1 0 11:13 ? 00:00:00 /sbin/wpa_supplicant -s -B -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /var/run/wpa_supplicant

iwconfig
lo no wireless extensions.

 wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Frequency:2.447 GHz Access Point: Not-Associated
Tx-Power=27 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off

再次执行 ifup ifdown wlan0 循环最终启动了 wlan0,尽管出现了拒绝该操作的错误消息,但还是无法为 wlan0 添加默认路由,因此仍然无法通过该接口 ping 通网络。

ip route
default via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.102
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.12

答案1

首先,169.254.xy 地址是一个虚拟地址,它告诉我们接口从接入点请求了一个地址,但并未获得地址。

我建议您使用 Wicd 或手动方法(/etc/network/interfaces),但不要同时使用两者。

第二,你的接口文件会自动启动 eth0 和 wlan0。我怀疑您是否想要或需要两者。假设您最常使用无线,我会注释掉“auto eth0”行。如果您希望使用以太网,请停止无线并启动以太网:

sudo ifdown wlan0 && sudo ifup eth0

接下来,接口文件期望 wpa-psk 是明文的 WPA2 密码。我建议您像这样清理 wlan0 文件:

auto wlan0 
iface wlan0 inet static
address 192.168.0.12
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8
wpa-ssid TPLINK
wpa-psk <your_key_in_clear_text>

最后,您还需要在 eth0 文件中声明 DNS 名称服务器。

答案2

我的 TP-Link WR841N 路由器的固件升级解决了这个问题。我升级到了固件版本:3.13.33 Build 130506 Rel.48660n,硬件版本为 8。我通过进入 TP-Link 菜单中的系统工具选项并选择“固件升级”选项来进行升级。

下载地址:

(Windows) 说明的链接:

对于遇到同样问题的人,请注意:我根据 TP-Link 支持的建议进行了升级。如果您遇到此问题,我建议您先与他们交谈(尽管我怀疑如果您这样做,您最终还是会做同样的事情,但谨慎一点总比后悔好。)

相关内容