Linux 从 DHCP 获取 IP,但仍然无法连接到 WPA2 WIFI

Linux 从 DHCP 获取 IP,但仍然无法连接到 WPA2 WIFI

这里我遇到了一个问题。

我有一个无线路由器,是 Buffalo WCR-HP-GN,我设置了一个使用 WPA2-PSK 认证和 TKIP 加密的密码的 WIFI。密码是 9 个字母的数字。

我老婆有一台 MacBook,它可以连接到 wifi。但我的联想 x200 安装了 Ubuntu 12.04 LTS,无法连接到 wifi。我检查了设置和 IP,一切正常。我可以通过 获取 IP dhclient,但当我尝试连接网关时ping,它不起作用。如果我尝试使用有线以太网电缆连接它,一切正常,我就可以ping连接网关。

谁能告诉我发生了什么事以及如何解决?谢谢!

这是dmesg我连接 WiFi 时的日志。

[85315.000578] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[85315.616173] usb 4-2: new full-speed USB device number 35 using uhci_hcd
[85321.433260] wlan0: authenticate with 4c:e6:76:5f:74:ff (try 1)
[85321.448196] wlan0: authenticated
[85321.449359] wlan0: associate with 4c:e6:76:5f:74:ff (try 1)
[85321.455113] wlan0: RX AssocResp from 4c:e6:76:5f:74:ff (capab=0x411 status=0 aid=2)
[85321.455122] wlan0: associated
[85321.463260] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[85321.464451] cfg80211: Calling CRDA for country: GB
[85321.475841] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
[85321.475852] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475859] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
[85321.475866] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475872] cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
[85321.475879] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475885] cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
[85321.475892] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475898] cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
[85321.475905] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475911] cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
[85321.475918] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475924] cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
[85321.475931] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475937] cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
[85321.475944] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475950] cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
[85321.475957] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475963] cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
[85321.475970] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475976] cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
[85321.475983] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.475989] cfg80211: Updating information on frequency 2467 MHz for a 20 MHz width channel with regulatory rule:
[85321.476029] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476035] cfg80211: Updating information on frequency 2472 MHz for a 20 MHz width channel with regulatory rule:
[85321.476042] cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476049] cfg80211: Updating information on frequency 5180 MHz for a 20 MHz width channel with regulatory rule:
[85321.476058] cfg80211: 5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476065] cfg80211: Updating information on frequency 5200 MHz for a 20 MHz width channel with regulatory rule:
[85321.476074] cfg80211: 5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476082] cfg80211: Updating information on frequency 5220 MHz for a 20 MHz width channel with regulatory rule:
[85321.476090] cfg80211: 5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476098] cfg80211: Updating information on frequency 5240 MHz for a 20 MHz width channel with regulatory rule:
[85321.476107] cfg80211: 5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476115] cfg80211: Updating information on frequency 5260 MHz for a 20 MHz width channel with regulatory rule:
[85321.476123] cfg80211: 5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476131] cfg80211: Updating information on frequency 5280 MHz for a 20 MHz width channel with regulatory rule:
[85321.476139] cfg80211: 5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476147] cfg80211: Updating information on frequency 5300 MHz for a 20 MHz width channel with regulatory rule:
[85321.476155] cfg80211: 5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476163] cfg80211: Updating information on frequency 5320 MHz for a 20 MHz width channel with regulatory rule:
[85321.476171] cfg80211: 5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[85321.476179] cfg80211: Updating information on frequency 5500 MHz for a 20 MHz width channel with regulatory rule:
[85321.476187] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476194] cfg80211: Updating information on frequency 5520 MHz for a 20 MHz width channel with regulatory rule:
[85321.476203] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476211] cfg80211: Updating information on frequency 5540 MHz for a 20 MHz width channel with regulatory rule:
[85321.476220] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476227] cfg80211: Updating information on frequency 5560 MHz for a 20 MHz width channel with regulatory rule:
[85321.476236] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476244] cfg80211: Updating information on frequency 5580 MHz for a 20 MHz width channel with regulatory rule:
[85321.476252] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476260] cfg80211: Updating information on frequency 5600 MHz for a 20 MHz width channel with regulatory rule:
[85321.476269] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476276] cfg80211: Updating information on frequency 5620 MHz for a 20 MHz width channel with regulatory rule:
[85321.476285] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476293] cfg80211: Updating information on frequency 5640 MHz for a 20 MHz width channel with regulatory rule:
[85321.476301] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476308] cfg80211: Updating information on frequency 5660 MHz for a 20 MHz width channel with regulatory rule:
[85321.476317] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476324] cfg80211: Updating information on frequency 5680 MHz for a 20 MHz width channel with regulatory rule:
[85321.476334] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476341] cfg80211: Updating information on frequency 5700 MHz for a 20 MHz width channel with regulatory rule:
[85321.476350] cfg80211: 5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A mBi, 2700 mBm)
[85321.476356] cfg80211: Disabling freq 5745 MHz
[85321.476362] cfg80211: Disabling freq 5765 MHz
[85321.476367] cfg80211: Disabling freq 5785 MHz
[85321.476372] cfg80211: Disabling freq 5805 MHz
[85321.476377] cfg80211: Disabling freq 5825 MHz
[85321.476390] cfg80211: Regulatory domain changed to country: GB
[85321.476396] cfg80211:     (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[85321.476404] cfg80211:     (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[85321.476412] cfg80211:     (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[85321.476419] cfg80211:     (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[85321.476427] cfg80211:     (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm)
[85326.605714] iwlwifi 0000:03:00.0: Tx aggregation enabled on ra = 4c:e6:76:5f:74:ff tid = 6
[85331.952112] wlan0: no IPv6 routers present

这是dhclient日志

$ sudo dhclient wlan0 -v
Internet Systems Consortium DHCP Client 4.1-ESV-R4
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/
Sending on   LPF/wlan0/
Sending on   Socket/fallback
DHCPREQUEST of 192.168.11.3 on wlan0 to 255.255.255.255 port 67
DHCPACK of 192.168.11.3 from 192.168.11.1
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd
RTNETLINK answers: File exists
bound to 192.168.11.3 -- renewal in 69538 seconds.

路由表:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.11.0    0.0.0.0         255.255.255.0   U     2      0        0 wlan0

我无法通过无线连接 ping 通:

$ ping 192.168.11.1
PING 192.168.11.1 (192.168.11.1) 56(84) bytes of data.
^C
--- 192.168.11.1 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 2999ms

我可以通过有线连接 ping 通:

$ ping 192.168.11.1
PING 192.168.11.1 (192.168.11.1) 56(84) bytes of data.
64 bytes from 192.168.11.1: icmp_req=1 ttl=64 time=0.988 ms
64 bytes from 192.168.11.1: icmp_req=2 ttl=64 time=0.811 ms
64 bytes from 192.168.11.1: icmp_req=3 ttl=64 time=0.820 ms
64 bytes from 192.168.11.1: icmp_req=4 ttl=64 time=0.860 ms
^C
--- 192.168.11.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.811/0.869/0.988/0.079 ms

答案1

我尝试找出问题所在,发现我使用的同一频道上有很多信号。如果我更改频道,我可以 ping 路由器 IP。我会在可以获得详细日志时编辑此答案 :)

答案2

尝试无线连接,然后使用另一台设备查看路由器页面,看看它是否将您的主机列为已连接。

另外,我在您的日志中看到了这一点:

192.168.11.3

这是分配给您电脑的 IP 地址吗?如果是,请尝试从路由器为该电脑的 MAC 地址分配一个静态 IP,或者在 Ubuntu 中设置静态 IP将其更改为路由器域内的内容,例如

192.168.11.13

(当然,前提是该 IP 还未被占用)

相关内容