可以 Ping 和 Telnet,但不能浏览任何网站

可以 Ping 和 Telnet,但不能浏览任何网站

我刚刚安装了 14.04。我无法使用 Ubuntu 浏览器和 Firefox(默认安装的唯一浏览器)浏览任何网站。但是,当我关闭终端时,我可以 ping 所有网站,并且我使用 telnet 成功连接。网络上的其他计算机可以毫无问题地浏览。

我遇到了非常类似的问题所有浏览器均出现连接超时,但 ping 和 telnet 可以正常工作除了我无法浏览我的路由器网络界面,与之前的海报不同。

我做了一个 tcpdump,虽然我不太确定我在寻找什么。我确实看到我的计算机 (10.0.0.23) 正在向 DNS 服务器请求 A 记录,并且正在接收它,然后尝试连接到服务器,但除此之外,我不确定我在看什么:

11:38:25.938342 IP 10.0.0.23.32925 > 75.75.75.75.53: 15275+ A? www.google.com. (32)
11:38:25.938416 IP 10.0.0.23.32925 > 75.75.76.76.53: 15275+ A? www.google.com. (32)
11:38:25.975842 IP 75.75.75.75.53 > 10.0.0.23.32925: 15275 6/0/0 A 64.233.176.105, A 64.233.176.103, A 64.233.176.106, A 64.233.176.147, A 64.233.176.104, A 64.233.176.99 (128)
11:38:25.976955 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [S], seq 2691308772, win 29200, options [mss 1460,sackOK,TS val 91559 ecr 0,nop,wscale 7], length 0
11:38:25.998335 IP 75.75.76.76.53 > 10.0.0.23.32925: 15275 5/0/0 A 173.194.37.51, A 173.194.37.52, A 173.194.37.48, A 173.194.37.50, A 173.194.37.49 (112)
11:38:25.998411 IP 10.0.0.23 > 75.75.76.76: ICMP 10.0.0.23 udp port 32925 unreachable, length 148
11:38:26.028372 IP 64.233.176.105.80 > 10.0.0.23.57541: Flags [S.], seq 4291033804, ack 2691308773, win 42540, options [mss 1430,sackOK,TS val 2140513279 ecr 91559,nop,wscale 7], length 0
11:38:26.028456 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 91572 ecr 2140513279], length 0
11:38:26.028815 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [P.], seq 1:291, ack 1, win 229, options [nop,nop,TS val 91572 ecr 2140513279], length 290
11:38:26.056790 IP 64.233.176.105.80 > 10.0.0.23.57541: Flags [.], ack 291, win 341, options [nop,nop,TS val 2140513334 ecr 91572], length 0
11:38:30.995159 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:32.966693 IP 10.0.0.1 > 224.0.0.1: igmp query v3 [max resp time 1.0s]
11:38:33.085665 IP 10.0.0.23 > 224.0.0.22: igmp v3 report, 1 group record(s)
11:38:33.108831 IP 10.0.0.15 > 224.0.0.22: igmp v3 report, 3 group record(s)
11:38:33.132271 IP 10.0.0.10 > 224.0.0.22: igmp v3 report, 3 group record(s)
11:38:33.296856 IP 169.254.237.81 > 224.0.0.22: igmp v3 report, 3 group record(s)
11:38:33.337661 IP 10.0.0.23.45440 > 74.125.137.136.443: Flags [.], ack 1, win 229, options [nop,nop,TS val 93400 ecr 2013263489,nop,nop,sack 1 {3928:3929}], length 0
11:38:33.357832 IP 74.125.137.136.443 > 10.0.0.23.45440: Flags [R], seq 1761464578, win 0, length 0
11:38:33.359058 IP 10.0.0.23.34167 > 216.58.216.64.443: Flags [S], seq 2488380, win 29200, options [mss 1460,sackOK,TS val 93405 ecr 0,nop,wscale 7], length 0
11:38:33.402075 IP 216.58.216.64.443 > 10.0.0.23.34167: Flags [S.], seq 3539282909, ack 2488381, win 42540, options [mss 1430,sackOK,TS val 2608512891 ecr 93405,nop,wscale 7], length 0
11:38:33.402158 IP 10.0.0.23.34167 > 216.58.216.64.443: Flags [.], ack 1, win 229, options [nop,nop,TS val 93416 ecr 2608512891], length 0
11:38:33.402789 IP 10.0.0.23.34167 > 216.58.216.64.443: Flags [P.], seq 1:165, ack 1, win 229, options [nop,nop,TS val 93416 ecr 2608512891], length 164
11:38:33.443965 IP 216.58.216.64.443 > 10.0.0.23.34167: Flags [.], ack 165, win 341, options [nop,nop,TS val 2608512935 ecr 93416], length 0
11:38:34.003661 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:34.297675 IP 10.0.0.23.41148 > 91.189.90.40.80: Flags [F.], seq 0, ack 1, win 229, options [nop,nop,TS val 93640 ecr 2356877716,nop,nop,sack 1 {2459:2460}], length 0
11:38:36.057656 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 94080 ecr 2140513334], length 0
11:38:36.995166 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:37.057655 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 94330 ecr 2140513334], length 0
11:38:37.083973 IP 64.233.176.105.80 > 10.0.0.23.57541: Flags [.], ack 291, win 341, options [nop,nop,TS val 2140524366 ecr 91572], length 0
11:38:38.342793 IP 10.0.0.15.58164 > 10.0.0.255.32414: UDP, length 21
11:38:39.996784 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:42.996470 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:43.344242 IP 10.0.0.15.58164 > 10.0.0.255.32414: UDP, length 21
11:38:43.441646 IP 10.0.0.23.34167 > 216.58.216.64.443: Flags [.], ack 1, win 229, options [nop,nop,TS val 95926 ecr 2608512935], length 0
11:38:43.455840 IP 216.58.216.64.443 > 10.0.0.23.34167: Flags [F.], seq 3927, ack 165, win 341, options [nop,nop,TS val 2608522948 ecr 93416], length 0
11:38:43.455896 IP 10.0.0.23.34167 > 216.58.216.64.443: Flags [.], ack 1, win 229, options [nop,nop,TS val 95929 ecr 2608512935,nop,nop,sack 1 {3927:3928}], length 0
11:38:43.476817 IP 216.58.216.64.443 > 10.0.0.23.34167: Flags [.], ack 165, win 341, options [nop,nop,TS val 2608522968 ecr 93416], length 0
11:38:46.000627 IP6 fe80::5e57:1aff:fed3:ee91 > ff02::1: ICMP6, router advertisement, length 104
11:38:47.097652 IP 10.0.0.23.57541 > 64.233.176.105.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 96840 ecr 2140513334], length 0
11:38:47.117175 IP 64.233.176.105.80 > 10.0.0.23.57541: Flags [.], ack 291, win 341, options [nop,nop,TS val 2140534396 ecr 91572], length 0
11:38:48.349341 IP 10.0.0.15.58164 > 10.0.0.255.32414: UDP, length 21

ping 命令的输出:

jtsmith2@SmallServer:~$ ping -c 5 google.com
PING google.com (74.125.196.138) 56(84) bytes of data.
64 bytes from yk-in-f139.1e100.net (74.125.196.139): icmp_seq=1 ttl=44 time=26.5 ms
64 bytes from yk-in-f139.1e100.net (74.125.196.139): icmp_seq=2 ttl=44 time=23.5 ms
64 bytes from yk-in-f139.1e100.net (74.125.196.139): icmp_seq=3 ttl=44 time=18.4 ms
64 bytes from yk-in-f139.1e100.net (74.125.196.139): icmp_seq=4 ttl=44 time=17.1 ms
64 bytes from yk-in-f139.1e100.net (74.125.196.139): icmp_seq=5 ttl=44 time=20.0 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 17.160/21.144/26.523/3.434 ms

jtsmith2@SmallServer:~$ ping -c 5 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_seq=1 ttl=57 time=24.8 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=20.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=19.5 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=57 time=18.1 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=57 time=16.3 ms

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 16.360/19.942/24.802/2.859 ms

编辑:

我也无法通过 wget 使用 http:

jtsmith2@SmallServer:~$ wget -v www.google.com/robots.txt
--2015-01-09 12:45:42-- http://www.google.com/robots.txt
Resolving www.google.com (www.google.com)... 64.233.185.147, 64.233.185.99, 64.233.185.103, ...
Connectiong to www.google.com (www.google.com)|64.233.185.147|:80... connected.
HTTP request sent, awaiting response...

它就挂在那里。

编辑#2,提供更多诊断信息:

jtsmith2@SmallServer:~$ sudo traceroute -n -T -p 80 www.google.com
sudo: traceroute: command not found

jtsmith2@SmallServer:~$ ip route
default via 10.0.0.1 dev wlan0 proto static
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.23 metric 9

jtsmith2@SmallServer:~$ ip route get 8.8.8.8
8.8.8.8 via 10.0.0.1 dev wlan0 src 10.0.0.23
    cache

jtsmith2@SmallServer:~$ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr e0:91:53:1a:c2:92
          inet addr:10.0.0.23  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  METRIC:1
          RX packets:4758 errors:0 dropped:0 overruns:0 frame:0
          TX packets:770 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:600533 (600.5 KB)  TX bytes:87112 (87.1 KB)

jtsmith2@SmallServer:~$ sudo ping -c3 -Mdo -n -s1472 www.google.com
PING www.google.com (173.194.37.83) 1472(1500) bytes of data.

--- www.google.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2015ms

然而大约10秒后……

jtsmith2@SmallServer:~$ sudo ping -c3 -Mdo -n -s1472 www.google.com
PING www.google.com (64.233.185.103) 1472(1500) bytes of data.
72 bytes from 64.233.185.103: icmp_seq=1 ttl=44 (truncated)
72 bytes from 64.233.185.103: icmp_seq=2 ttl=44 (truncated)
72 bytes from 64.233.185.103: icmp_seq=3 ttl=44 (truncated)

--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 39.738/50.665/72.381/15.357 ms

但是增加一个字节:

jtsmith2@SmallServer:~$ sudo ping -c3 -Mdo -n -s1473 www.google.com
PING www.google.com (74.125.196.105) 1473(1501) bytes of data.
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500

--- www.google.com ping statistics ---
3 packets transmitted, 0 received, 3+ errors, 100% packet loss, time 1999ms

任何想法或解决方案都将非常有帮助并受到赞赏。

答案1

请发布以下命令的输出,我会尽力提供帮助。在这里修改我的答案比在评论中修改更容易。

使用 TCP 跟踪路由到端口 80 检查 www.google.com 的路径:

sudo traceroute -n -T -p 80 www.google.com

路由的配置:

ip route

用于向外部网络发送数据包的接口:

ip route get 8.8.8.8

使用以下命令显示您在上面的命令输出中看到的接口的配置:

ifconfig <interface>

我对您使用的互联网接入技术种类的信息特别感兴趣。

有时,当您使用 ADSL、VDSL 等访问方法时,协议封装开销可能意味着 1500 字节的默认 MTU 将允许较小的响应(例如 ICMP 数据包或简单的 telnet 请求)返回到您的机器,但较大的响应将被默默丢弃,因为响应的大小 + 多层封装协议头的大小将超过您的 MTU。

如果您理解 MTU 的概念,并想尝试找出连接在哪个 MTU 下开始中断,则可以使用 ping 作为诊断工具,并请求不进行分段并发送特定大小的数据包。示例:

sudo ping -c3 -Mdo -n -s1472 www.google.com

上述操作将尝试发送包含 1472 字节 ICMP 有效负载 + 28 字节报头(总共 1500 字节)的数据包,这很可能会失败。尝试通过调整 -s 参数来降低有效负载的大小,直到您开始收到回复并让我知道它是什么。

请更新您的问题,我会尽力帮助您解决问题。

更新:

您能否尝试下面的命令,看看之后浏览是否开始正常工作?

sudo iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o wlan0 -j TCPMSS --set-mss 1460

相关内容