linux的ping结果分析,linux – 来自ping的奇怪结果

如果通过IP ping而不是hostname,则会收到预期的行为.

我仍在调查,以了解为什么会这样.

# find IP address of host

$host -t a google.com

google.com has address 74.125.225.17

google.com has address 74.125.225.19

google.com has address 74.125.225.20

google.com has address 74.125.225.18

google.com has address 74.125.225.16

# pick an IP and ping it, all output is displayed at once

$sudo ping 74.125.225.17 -c 25 -l 25

PING 74.125.225.17 (74.125.225.17) 56(84) bytes of data.

64 bytes from 74.125.225.17: icmp_seq=1 ttl=55 time=29.7 ms

64 bytes from 74.125.225.17: icmp_seq=2 ttl=55 time=30.4 ms

64 bytes from 74.125.225.17: icmp_seq=3 ttl=55 time=40.0 ms

64 bytes from 74.125.225.17: icmp_seq=4 ttl=55 time=40.4 ms

64 bytes from 74.125.225.17: icmp_seq=7 ttl=55 time=50.1 ms

64 bytes from 74.125.225.17: icmp_seq=5 ttl=55 time=50.4 ms

64 bytes from 74.125.225.17: icmp_seq=6 ttl=55 time=51.4 ms

64 bytes from 74.125.225.17: icmp_seq=8 ttl=55 time=52.4 ms

64 bytes from 74.125.225.17: icmp_seq=9 ttl=55 time=55.4 ms

64 bytes from 74.125.225.17: icmp_seq=10 ttl=55 time=56.4 ms

64 bytes from 74.125.225.17: icmp_seq=11 ttl=55 time=57.3 ms

64 bytes from 74.125.225.17: icmp_seq=13 ttl=55 time=58.3 ms

64 bytes from 74.125.225.17: icmp_seq=12 ttl=55 time=59.3 ms

64 bytes from 74.125.225.17: icmp_seq=14 ttl=55 time=60.3 ms

64 bytes from 74.125.225.17: icmp_seq=15 ttl=55 time=61.9 ms

64 bytes from 74.125.225.17: icmp_seq=16 ttl=55 time=62.3 ms

64 bytes from 74.125.225.17: icmp_seq=17 ttl=55 time=63.2 ms

64 bytes from 74.125.225.17: icmp_seq=18 ttl=55 time=64.2 ms

64 bytes from 74.125.225.17: icmp_seq=19 ttl=55 time=68.9 ms

64 bytes from 74.125.225.17: icmp_seq=20 ttl=55 time=69.2 ms

64 bytes from 74.125.225.17: icmp_seq=21 ttl=55 time=70.2 ms

64 bytes from 74.125.225.17: icmp_seq=22 ttl=55 time=75.9 ms

64 bytes from 74.125.225.17: icmp_seq=23 ttl=55 time=76.2 ms

64 bytes from 74.125.225.17: icmp_seq=24 ttl=55 time=77.2 ms

64 bytes from 74.125.225.17: icmp_seq=25 ttl=55 time=78.1 ms

UPDATE

通过strace运行ping后,我发现它在名称解析时被挂起(毫不奇怪).然而,引起我注意的是avahi-daemon.该服务实现了Apple的Zeroconf架构(也称为“Rendezvous”或“Bonjour”).换句话说,我不需要的功能.

停止avahi-daemon后,ping行为恢复正常.

# sudo /etc/init.d/avahi-daemon stop

在启动期间禁用它可以通过以下方式完成:

# sudo update-rc.d -f avahi-daemon

另一种解决方法是使用-n标志和ping.挂断是在处理回复时执行的反向DNS查找.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值