![我的 Ubuntu 无法访问互联网](https://linux22.com/image/983013/%E6%88%91%E7%9A%84%20Ubuntu%20%E6%97%A0%E6%B3%95%E8%AE%BF%E9%97%AE%E4%BA%92%E8%81%94%E7%BD%91.png)
我的 Ubuntu 无法访问互联网,而安装在 Ubuntu 中的 Virtual Box 上的虚拟 Windows 计算机却可以。该虚拟机的网络配置为 wlan0 桥接类型。我甚至无法从 Ubuntu ping 通 wlan0 接口上的默认网关,但 Windows 计算机上的一切都运行正常。
输出ifconfig wlan0
Link encap:Ethernet HWaddr 60:36:dd:14:d2:3c
inet addr:172.30.60.188 Bcast:172.30.60.255 Mask:255.255.255.0
inet6 addr: fe80::6236:ddff:fe14:d23c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:332314 errors:0 dropped:54 overruns:0 frame:0
TX packets:43703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:66076979 (66.0 MB) TX bytes:5894865 (5.8 MB)
输出route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.30.60.1 0.0.0.0 UG 1024 0 0 wlan0
81.31.160.0 172.30.60.1 255.255.224.0 UG 10 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
172.30.60.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
213.233.160.0 172.30.60.1 255.255.224.0 UG 10 0 0 wlan0
请注意,来自 Windows 机器的 ping 将会非常快速地响应,但来自 Ubuntu 的 ping 将会非常缓慢地响应。
出ping 172.30.60.1
,这是默认网关。
PING 172.30.60.1 (172.30.60.1) 56(84) bytes of data.
64 bytes from 172.30.60.1: icmp_seq=62 ttl=255 time=43.4 ms
64 bytes from 172.30.60.1: icmp_seq=63 ttl=255 time=3.85 ms
64 bytes from 172.30.60.1: icmp_seq=71 ttl=255 time=4.78 ms
64 bytes from 172.30.60.1: icmp_seq=82 ttl=255 time=2.44 ms
64 bytes from 172.30.60.1: icmp_seq=127 ttl=255 time=2.31 ms
64 bytes from 172.30.60.1: icmp_seq=148 ttl=255 time=154 ms
64 bytes from 172.30.60.1: icmp_seq=217 ttl=255 time=4.06 ms
64 bytes from 172.30.60.1: icmp_seq=225 ttl=255 time=2.97 ms
64 bytes from 172.30.60.1: icmp_seq=333 ttl=255 time=101 ms
64 bytes from 172.30.60.1: icmp_seq=334 ttl=255 time=71.3 ms
64 bytes from 172.30.60.1: icmp_seq=473 ttl=255 time=14.5 ms
64 bytes from 172.30.60.1: icmp_seq=474 ttl=255 time=2.47 ms
64 bytes from 172.30.60.1: icmp_seq=544 ttl=255 time=10.0 ms
64 bytes from 172.30.60.1: icmp_seq=585 ttl=255 time=745 ms
64 bytes from 172.30.60.1: icmp_seq=586 ttl=255 time=488 ms
64 bytes from 172.30.60.1: icmp_seq=587 ttl=255 time=863 ms
64 bytes from 172.30.60.1: icmp_seq=589 ttl=255 time=2048 ms
64 bytes from 172.30.60.1: icmp_seq=590 ttl=255 time=1234 ms
64 bytes from 172.30.60.1: icmp_seq=591 ttl=255 time=227 ms
64 bytes from 172.30.60.1: icmp_seq=592 ttl=255 time=121 ms
^C
--- 172.30.60.1 ping statistics ---
639 packets transmitted, 20 received, 96% packet loss, time 642600ms
rtt min/avg/max/mdev = 2.319/307.380/2048.298/523.403 ms, pipe 3
如你所见,数据包丢失率为 96%。这个问题对我来说很奇怪!
另外也许值得一提的是,在安装软件包之前,我的 Ubuntu 运行aircrack-ng
良好wireshark
。
编辑#1
输出lspci -knn | grep Net -A2
Network controller [0280]: Intel Corporation Centrino Wireless-N 2230 [8086:0888] (rev c4)
Subsystem: Intel Corporation Centrino Wireless-N 2230 BGN [8086:4262]
Kernel driver in use: iwlwifi
输出iwconfig
IEEE 802.11bgn ESSID:"Shadmaan"
Mode:Managed Frequency:2.462 GHz Access Point: 0A:18:D6:A9:49:FE
Bit Rate=58.5 Mb/s Tx-Power=16 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=49/70 Signal level=-61 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:116 Invalid misc:4646 Missed beacon:0
编辑#2
完整输出iwconfig
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"Shadmaan"
Mode:Managed Frequency:2.462 GHz Access Point: 0A:18:D6:A9:49:FE
Bit Rate=58.5 Mb/s Tx-Power=16 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=49/70 Signal level=-61 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:116 Invalid misc:4646 Missed beacon:0
ppp0 no wireless extensions.
lo no wireless extensions.
答案1
在终端中运行
sudo tee /etc/modprobe/iwlwifi-opt.conf <<< "options iwlwifi swcrypto=1 11n_disable=1 bt_coex_active=0 power_save=0"
然后重新启动。
这将禁用所有有问题的选项。您可以通过编辑文件来测试是否需要所有选项/etc/modprobe/iwlwifi-opt.conf
。