📅  最后修改于: 2023-12-03 15:02:43.582000             🧑  作者: Mango
PING 命令是一种测试网络连接的基本工具。它使用 Internet 控制消息协议(ICMP)来测试连通性,以确定远程主机是否可访问。
ping [-dfnqrRv][-c count][-i interval][-l preload][-p pattern][-s packetsize][-t ttl] host
-c count
:发送指定数量的 PING 请求并退出。-i interval
:发送请求的时间间隔(秒)。-s packetsize
:设置每个数据包的大小。-t ttl
:设置数据包生存时间(跳数)。-v
:详细显示 ping 命令的输出。-q
:最小输出。$ ping www.google.com
输出:
PING www.google.com (172.217.25.68) 56(84) bytes of data.
64 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=1 ttl=118 time=9.36 ms
...
$ ping -c 3 www.google.com
输出:
PING www.google.com (172.217.25.68) 56(84) bytes of data.
64 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=1 ttl=118 time=9.36 ms
...
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 9.358/9.485/9.617/0.109 ms
$ ping -i 2 www.google.com
输出:
PING www.google.com (172.217.25.68) 56(84) bytes of data.
64 bytes from syd09s13-in-f4.1e100.net (172.217.25.68): icmp_seq=1 ttl=118 time=9.36 ms
...
64 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=7 ttl=118 time=9.32 ms
--- www.google.com ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 16009ms
rtt min/avg/max/mdev = 9.300/9.381/9.543/0.099 ms
$ ping -s 500 www.google.com
输出:
PING www.google.com (172.217.25.68) 500(528) bytes of data.
508 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=1 ttl=118 time=9.26 ms
...
508 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=5 ttl=118 time=9.22 ms
--- www.google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 52ms
rtt min/avg/max/mdev = 9.226/9.269/9.298/0.075 ms
$ ping -t 3 www.google.com
输出:
PING www.google.com (172.217.25.68) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Time to live exceeded
From 10.0.0.1 icmp_seq=2 Time to live exceeded
From 10.0.0.1 icmp_seq=3 Time to live exceeded
--- www.google.com ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2004ms
$ ping -v www.google.com
输出:
PING www.google.com (172.217.25.68) 56(84) bytes of data.
64 bytes from syd09s13-in-f68.1e100.net (172.217.25.68): icmp_seq=1 ttl=118 time=9.36 ms
...