ping侦测两主机是否连通 选项: -c 数值:ping的次数 -n:输出数据不进行ip与主机名反查 -s 数值:指定ICMP数据包大小,默认64bytes -t 数值:TTL的数值,外网默认255,局域网默认64 -W 数值:等待响应对方主机的秒数
[root@www ~]# ping baidu.com PING baidu.com (111.13.101.208) 56(84) bytes of data. 64 bytes from 111.13.101.208: icmp_seq=1 ttl=128 time=4.41 ms 64 bytes from 111.13.101.208: icmp_seq=2 ttl=128 time=4.61 ms [root@www ~]# ping 192.168.146.130 PING 192.168.146.130 (192.168.146.130) 56(84) bytes of data. 64 bytes from 192.168.146.130: icmp_seq=1 ttl=64 time=3.32 ms 64 bytes from 192.168.146.130: icmp_seq=2 ttl=64 time=0.195 ms
[root@www ~]# ping baidu.com -c 2 PING baidu.com (111.13.101.208) 56(84) bytes of data. 64 bytes from 111.13.101.208: icmp_seq=1 ttl=128 time=4.24 ms 64 bytes from 111.13.101.208: icmp_seq=2 ttl=128 time=4.35 ms
--- baidu.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 2025ms rtt min/avg/max/mdev = 4.246/4.298/4.350/0.052 ms
[root@www ~]# ping baidu.com -s 128 PING baidu.com (220.181.57.216) 128(156) bytes of data. 136 bytes from 220.181.57.216: icmp_seq=1 ttl=128 time=3.91 ms 136 bytes from 220.181.57.216: icmp_seq=2 ttl=128 time=3.42 ms 136 bytes from 220.181.57.216: icmp_seq=3 ttl=128 time=3.31 ms 136 bytes from 220.181.57.216: icmp_seq=4 ttl=128 time=3.53 ms
--- baidu.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 4949ms rtt min/avg/max/mdev = 3.310/3.545/3.913/0.230 ms