可以解析域名,可以上网,但ping命令失败

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
a1017752020
帖子: 5
注册时间: 2017-10-20 14:27
系统: ubuntu

可以解析域名,可以上网,但ping命令失败

#1

帖子 a1017752020 » 2017-10-20 14:37

测试了一下python.socket的gethostbyname,然后发现一直失败。后测试了ping命令,抓包结果全是 no response found ; 然后测试了ping内网,能够正常返回,ping网关也能正常,网页也能正常打开,这就奇怪了。
在同环境下,使用window系统,可以正常ping www.baidu.com,但ubuntu就不行,有没有大神知道可能是哪里的问题啊
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 可以解析域名,可以上网,但ping命令失败

#2

帖子 poloshiao » 2017-10-20 15:18

http://blog.5ibc.net/p/158195.html
问题出在我是使用了校园网 ?
a1017752020
帖子: 5
注册时间: 2017-10-20 14:27
系统: ubuntu

Re: 可以解析域名,可以上网,但ping命令失败

#3

帖子 a1017752020 » 2017-10-21 15:06

poloshiao 写了:http://blog.5ibc.net/p/158195.html
问题出在我是使用了校园网 ?
不是,我是用实体机装ubuntu,而且可以上网,只是不能ping通
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 可以解析域名,可以上网,但ping命令失败

#4

帖子 poloshiao » 2017-10-21 16:12

不是,我是用实体机装ubuntu,而且可以上网,只是不能ping通
是問你的實體機上網 是否 連接校園網 ?
a1017752020
帖子: 5
注册时间: 2017-10-20 14:27
系统: ubuntu

Re: 可以解析域名,可以上网,但ping命令失败

#5

帖子 a1017752020 » 2017-10-21 17:36

poloshiao 写了:
不是,我是用实体机装ubuntu,而且可以上网,只是不能ping通
是問你的實體機上網 是否 連接校園網 ?
没有,用的公司的网,固定IP
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 可以解析域名,可以上网,但ping命令失败

#6

帖子 poloshiao » 2017-10-21 19:54

使用window系统,可以正常ping www.baidu.com,但ubuntu就不行
1. 在 Windows
ping -c 3 www.baidu.com
把結果複製貼上來 (不要摘錄)

2. 在 Ubuntu
2-1. ping -c 3 www.baidu.com
2-2. ping -c 3 forum.ubuntu.com.cn
2-3. ping -c 3 forum.ubuntu.org.cn
把結果複製貼上來 (不要摘錄)
a1017752020
帖子: 5
注册时间: 2017-10-20 14:27
系统: ubuntu

Re: 可以解析域名,可以上网,但ping命令失败

#7

帖子 a1017752020 » 2017-10-23 11:51

poloshiao 写了:
使用window系统,可以正常ping http://www.baidu.com,但ubuntu就不行
1. 在 Windows
ping -c 3 http://www.baidu.com
把結果複製貼上來 (不要摘錄)

2. 在 Ubuntu
2-1. ping -c 3 http://www.baidu.com
2-2. ping -c 3 forum.ubuntu.com.cn
2-3. ping -c 3 forum.ubuntu.org.cn
把結果複製貼上來 (不要摘錄)
1. Windows下没有 -c,但我猜测是-n
正在 Ping www.a.shifen.com [61.135.169.121] 具有 32 字节的数据:
来自 61.135.169.121 的回复: 字节=32 时间=32ms TTL=55
来自 61.135.169.121 的回复: 字节=32 时间=29ms TTL=55
来自 61.135.169.121 的回复: 字节=32 时间=33ms TTL=55

61.135.169.121 的 Ping 统计信息:
数据包: 已发送 = 3,已接收 = 3,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 29ms,最长 = 33ms,平均 = 31ms
2.Ubuntu
2-1.
jrz@JRZ:~$ ping -c 3 www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.

--- www.a.shifen.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2053ms

2-2.
jrz@JRZ:~$ ping -c 3 forum.ubuntu.com.cn
PING forum.ubuntu.com.cn (104.27.158.18) 56(84) bytes of data.

--- forum.ubuntu.com.cn ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2035ms

2-3.
jrz@JRZ:~$ ping -c 3 forum.ubuntu.org.cn
PING forum.ubuntu.org.cn (198.71.84.64) 56(84) bytes of data.

--- forum.ubuntu.org.cn ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2043ms
a1017752020
帖子: 5
注册时间: 2017-10-20 14:27
系统: ubuntu

Re: 可以解析域名,可以上网,但ping命令失败

#8

帖子 a1017752020 » 2017-10-23 12:02

原因找到了!!!!!
ubuntu默认ping包的大小是64字节,windows下是32字节
手动修改后就可以ping通过了,原因不明
回复