当前位置: 首页 > news >正文

Linux shell编程学习笔记66:ping命令 超详细的选项说明

0 前言

网络信息是电脑网络信息安全检查中的一块重要内容,Linux和基于Linux的操作系统,提供了很多的网络命令,今天我们研究最常用的ping命令。

1 ping命令 的功能、格式和选项说明

1.1 ping命令 的功能

简单来说, ping 命令 会使用 ICMP(Internet Control Message Protocol) 传输协议,向网络主机发出要求回应的信息,若网络主机的网络功能没有问题,就会回应该信息,从而得知该主机运作正常。

具体来说,ping 命令使用 ICMP 协议的强制ECHO_REQUEST数据报从主机或网关引出 ICMP ECHO_RESPONSE。ECHO_REQUEST数据报 (''pings'') 都有一个 IP 和 ICMP 标头,后跟一个结构体 timeval,然后是用于填充数据包的任意数量的 ''pad'' 字节。

 ping 命令常用于检测 网络中的另一台主机或路由器是否可访问。

1.2 Linux中的ping命令支持ipV6吗?

  • 在基于 Debian 的 Linux 发行版(包括 Ubuntu)上,您可以使用 ping6 命令强制 ping 使用 IPv6 而不是 IPv4。
  • 在基于 Red Hat 的发行版(如 CentOS)和基于 Arch Linux 的发行版(如 Manjaro)上,使用带 -6 选项的 ping 命令来强制 IPv6。 

1.3 Linux中的ping命令与Windows中的ping命令相同吗?

Linux中的ping命令与Windows中的ping命令在功能上可以说是相同的,但是两者在某些方面存在不同。例如,在默认情况下,Linux 下的ping会连续发送包,而Windows的ping命令 仅发送 4 个包。 

Windows 中的ping命令格式如下:

C:\Users\purpleendurer>ping用法: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS][-r count] [-s count] [[-j host-list] | [-k host-list]][-w timeout] [-R] [-S srcaddr] [-c compartment] [-p][-4] [-6] target_name选项:-t             Ping 指定的主机,直到停止。若要查看统计信息并继续操作,请键入 Ctrl+Break;若要停止,请键入 Ctrl+C。-a             将地址解析为主机名。-n count       要发送的回显请求数。-l size        发送缓冲区大小。-f             在数据包中设置“不分段”标记(仅适用于 IPv4)。-i TTL         生存时间。-v TOS         服务类型(仅适用于 IPv4。该设置已被弃用,对 IP 标头中的服务类型字段没有任何影响)。-r count       记录计数跃点的路由(仅适用于 IPv4)。-s count       计数跃点的时间戳(仅适用于 IPv4)。-j host-list   与主机列表一起使用的松散源路由(仅适用于 IPv4)。-k host-list    与主机列表一起使用的严格源路由(仅适用于 IPv4)。-w timeout     等待每次回复的超时时间(毫秒)。-R             同样使用路由标头测试反向路由(仅适用于 IPv6)。根据 RFC 5095,已弃用此路由标头。如果使用此标头,某些系统可能丢弃回显请求。-S srcaddr     要使用的源地址。-c compartment 路由隔离舱标识符。-p             Ping Hyper-V 网络虚拟化提供程序地址。-4             强制使用 IPv4。-6             强制使用 IPv6。

1.4 ping命令的格式

与我们之前学的大多数linux命令不同,ping命令不支持--help选项。

我们可以使用ping 或 ping -?命令获取ping命令的格式信息。

[purpleendurer @ bash ~] ping
Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface][-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos][-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option][-w deadline] [-W timeout] [hop1 ...] destination
Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface][-l preload] [-m mark] [-M pmtudisc_option][-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize][-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline][-W timeout] destination
[purpleendurer @ bash ~] ping -?
Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface][-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos][-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option][-w deadline] [-W timeout] [hop1 ...] destination
Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface][-l preload] [-m mark] [-M pmtudisc_option][-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize][-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline][-W timeout] destination
[purpleendurer @ bash ~] 

1.4.1支持ipV4的ping命令格式

 ping [-aAbBdDfhLnOqrRUvV64] [-c 完成次数] [-i 间隔秒数] [-I 网络界面]
        [-m mark] [-M pmtudisc_option] [-l 前置载入] [-p 范本样式] [-Q tos]
        [-s 数据包大小] [-S sndbuf] [-t 存活数值] [-T 间间戳选项]
        [-w 退出前等待秒数] [-W 执行前等待秒数] [hop1 ...] 目标主机名称或IP地址

1.4.2 支持ipV6的ping命令格式

ping -6 [-aAbBdDfhLnOqrRUvV] [-c 完成次数] [-i 间隔秒数] [-I 网络界面]
             [-l 前置载入]  [-m mark]  [-M pmtudisc_option]
             [-N nodeinfo_option] [-p 范本样式]  [-Q tclass]  [-s 数据包大小]
             [-S sndbuf] [-t 存活数值] [-T 间间戳选项]  [-w 退出前等待秒数] 
             [[-W 执行前等待秒数]  目标主机名称或IP地址 

1.5 ping命令选项说明

ping命令的选项非常多,而且不同版本linux 提供的ping命令选项也不尽相同。

参数描述
-a

Audible ping.

可听到的ping

-A
  1. Adaptive ping.
  2. Interpacket interval adapts to round-trip time, so that effectively not more than one (or more, if preload is set) unanswered probes present in the network.
  3. Minimal interval is 200msec for not super-user.
  4. On networks with low rtt this mode is essentially equivalent to flood mode.

  1. 自适应 ping。
  2. 数据包间间隔适应往返时间,因此网络中实际上不存在超过一个(或多个,如果设置了预加载)未应答的探测器。
  3. 对于非超级用户,最小间隔为 200 毫秒。
  4. 在低 rtt 的网络上,此模式基本上等同于泛洪模式。
-b

Allow pinging a broadcast address.

允许对广播地址进行ping

-B
  1. Do not allow ping to change source address of probes.
  2. The address is bound to one selected when ping starts.

  1. 不允许ping更改探测的来源地址。
  2. 地址绑定到ping启动时选定的一个地址上。
-c count
  1. Stop after sending count ECHO_REQUEST packets.
  2. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires.

  1. 发送指定数量的ECHO_REQUEST数据包后停止。
  2. 使用deadline选项,ping等待count个ECHO_REPLY数据包,直到超时。
-d
  1. Set the SO_DEBUG option on the socket being used.
  2. Essentially, this socket option is not used by Linux kernel.

  1. 在使用的套接字上设置SO_DEBUG选项。
  2. 实际上,Linux内核不使用此套接字选项。
-F flow label
  1. Allocate and set 20 bit flow label on echo request packets. (Only ping6).
  2. If value is zero, kernel allocates random flow label.

  1. 在回显请求数据包上分配并设置20位流标签。(仅限ping6)。
  2. 如果值为零,则内核分配随机的流标签。
-f
  1. Flood ping. For every ECHO_REQUEST sent a period ''.'' is printed, while for ever ECHO_REPLY received a backspace is printed.
  2. This provides a rapid display of how many packets are being dropped.
  3. If interval is not given, it sets interval to zero and outputs packets as fast as they come back or one hundred times per second, whichever is more.
  4. Only the super-user may use this option with zero interval.

  1. 洪泛ping。对于每个发送的ECHO_REQUEST,打印一个句点“.”,对于每个接收的ECHO_REPLY,打印一个退格符。
  2. 这提供了快速显示丢包数量的方式。
  3. 如果没有给出间隔,它将间隔设置为零,并且以数据包回来的速度输出或者每秒一百次,以两者中较大的为准。
  4. 只有超级用户可以使用此选项和零间隔。
-i interval
  1. Wait interval seconds between sending each packet.
  2. The default is to wait for one second between each packet normally, or not to wait in flood mode.
  3. Only super-user may set interval to values less 0.2 seconds.   

  1. 在发送每个数据包之间等待指定的时间间隔。
  2. 默认情况下,每个数据包之间等待一秒钟,或者在洪泛模式下不等待。
  3. 只有超级用户可以将间隔设置为小于0.2秒的值。
-I interface address
  1. Set source address to specified interface address.
  2. Argument may be numeric IP address or name of device.
  3. When pinging IPv6 link-local address this option is required.

  1. 将源地址设置为指定的接口地址。
  2. 参数可以是数值IP地址或设备名称。
  3. 在ping IPv6链路本地地址时需要此选项。

-l preload

  1. If preload is specified, ping sends that many packets not waiting for reply.
  2. Only the super-user may select preload more than 3.

  1. 如果指定了preload,则ping发送指定数量的数据包而不等待响应。
  2. 只有超级用户可以选择预加载超过3个的数据包。
-L
  1. Suppress loopback of multicast packets.
  2. This flag only applies if the ping destination is a multicast address.

  1. 屏蔽组播数据包的回路。
  2. 这个标志仅适用于ping目的地是一个组播地址的情况。
-n
  1. Numeric output only.
  2. No attempt will be made to lookup symbolic names for host addresses.

  1. 仅输出数值形式。
  2. 不尝试查找主机地址的符号名称。
-p pattern
  1. You may specify up to 16 ''pad'' bytes to fill out the packet you send.
  2. This is useful for diagnosing data-dependent problems in a network.
  3. For example, -p ff will cause the sent packet to be filled with all ones.

  1. 您可以指定最多16个填充字节来填充发送的数据包。
  2. 这对于诊断网络中依赖于数据的问题很有用。
  3. 例如,-p ff将导致发送的数据包全部填充为1。
-Q tos
  1. Set Quality of Service -related bits in ICMP datagrams.
  2. tos can be either decimal or hex number.
  3. Traditionally (RFC1349), these have been interpreted as: 0 for reserved (currently being redefined as congestion control), 1-4 for Type of Service and 5-7 for Precedence. Possible settings for Type of Service are: minimal cost: 0x02, reliability: 0x04, throughput: 0x08, low delay: 0x10.
  4. Multiple TOS bits should not be set simultaneously.
  5. Possible settings for special Precedence range from priority (0x20) to net control (0xe0).
  6. You must be root (CAP_NET_ADMIN capability) to use Critical or higher precedence value.
  7. You cannot set bit 0x01 (reserved) unless ECN has been enabled in the kernel.
  8. In RFC2474, these fields has been redefined as 8-bit Differentiated Services (DS), consisting of: bits 0-1 of separate data (ECN will be used, here), and bits 2-7 of Differentiated Services Codepoint (DSCP).

  1. 设置ICMP数据报中的服务质量相关位。
  2. tos可以是十进制或十六进制数。
  3. 传统上(RFC1349),这些被解释为:0表示保留(目前正在重新定义为拥塞控制),1-4表示服务类型,5-7表示优先级。服务类型的可能设置为:最低成本:0x02,可靠性:0x04,吞吐量:0x08,低延迟:0x10。
  4. 请勿同时设置多个TOS位。
  5. 特殊优先级的可能设置范围从优先级(0x20)到网络控制(0xe0)。
  6. 您必须具有root(CAP_NET_ADMIN权限)才能使用重要或更高优先级的值。
  7. 除非已在内核中启用了ECN,否则不能设置位0x01(保留)。
  8. 在RFC2474中,这些字段已被重新定义为8位区分服务(DS),包括:单独数据的位0-1(这里将使用ECN),以及不同服务代码点(DSCP)的位2-7。
-q
  1. Quiet output.
  2. Nothing is displayed except the summary lines at startup time and when finished.

  1. 静默输出。
  2. 除了启动时和完成时的总结行外,不显示任何内容。
-R
  1. Record route.
  2. Includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets.
  3. Note that the IP header is only large enough for nine such routes.
  4. Many hosts ignore or discard this option.

  1. 记录路由。
  2. 在ECHO_REQUEST数据包中包含RECORD_ROUTE选项,并在返回的数据包上显示路由缓冲区。
  3. 请注意,IP头部仅足够存储9个此类路由。
  4. 许多主机忽略或丢弃此选项。
-r
  1. Bypass the normal routing tables and send directly to a host on an attached interface.
  2. If the host is not on a directly-attached network, an error is returned.
  3. This option can be used to ping a local host through an interface that has no route through it provided the option -I is also used.

  1. 绕过正常路由表,直接发送到连接的主机。
  2. 如果主机不在直接连接的网络上,则返回错误。
  3. 使用选项-I可以通过没有路由的接口ping本地主机。
-s packetsize
  1. Specifies the number of data bytes to be sent.
  2. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.

  1. 指定要发送的数据字节数。
  2. 默认为56个字节,与8个字节的ICMP头数据组合在一起,总共是64个ICMP数据字节。
-S sndbuf
  1. Set socket sndbuf.
  2. If not specified, it is selected to buffer not more than one packet.    

  1. 设置套接字的sndbuf。
  2. 如果未指定,则选择的缓冲区不超过一个数据包。
-t ttl

Set the IP Time to Live.

设置IP的生存时间(TTL)

-T timestamp option
  1. Set special IP timestamp options.
  2. timestamp option may be either tsonly (only timestamps), tsandaddr (timestamps and addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified hops).

  1. 设置特殊的IP时间戳选项。
  2. 时间戳选项可以是tsonly(仅时间戳),tsandaddr(时间戳和地址)或tsprespec host1 [host2 [host3 [host4]]](预指定时间戳跳数)。
-M hint
  1. Select Path MTU Discovery strategy.
  2. hint may be either do (prohibit fragmentation, even local one), want (do PMTU discovery, fragment locally when packet size is large), or dont (do not set DF flag).

  1. 选择路径MTU发现策略。
  2. 提示可以是do(禁止分段,即使是本地分段),want(进行PMTU发现,当数据包大小较大时在本地分段),或dont(不设置DF标志)。
-U
  1. Print full user-to-user latency (the old behaviour).
  2. Normally ping prints network round trip time, which can be different f.e. due to DNS failures.

  1. 打印完整的用户到用户延迟(旧行为)。
  2. 通常,ping打印网络往返时间,这可以与由于DNS故障等原因不同。
-v

Verbose output.

详细输出

-V

Show version and exit.

显示版本并退出

-w deadline
  1. Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received.
  2. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.

  1. 指定超时时间(秒),在此时间内ping无论发送或接收到多少个数据包都会退出。
  2. 在这种情况下,ping不会在发送count个数据包后停止,它会等待deadline到期或直到接收到count个探测的响应或接收到某些来自网络的错误通知。
-W timeout
  1. Time to wait for a response, in seconds.
  2. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.

  1. 等待响应的时间(秒)。
  2. 该选项仅在没有收到任何响应的情况下影响超时,否则ping等待两个往返时间。

2 ping命令实例

2.1 ping -a g.cn

[purpleendurer @ bash ~] ping -a g.cn
PING g.cn (114.250.67.34) 56(84) bytes of data.
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=1 ttl=116 time=4.41 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=2 ttl=116 time=4.36 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=3 ttl=116 time=4.34 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=4 ttl=116 time=4.38 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=5 ttl=116 time=4.34 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=6 ttl=116 time=4.36 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=7 ttl=116 time=4.36 ms
^C
--- g.cn ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6007ms
rtt min/avg/max/mdev = 4.342/4.368/4.414/0.041 ms
[purpleendurer @ bash ~] 

1.2 ping -A g.cn :自适应 ping g.cn

[purpleendurer @ bash ~] ping -A g.cn
PING g.cn (114.250.70.34) 56(84) bytes of data.
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=1 ttl=117 time=5.04 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=2 ttl=117 time=4.76 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=3 ttl=117 time=4.76 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=4 ttl=117 time=4.77 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=5 ttl=117 time=4.76 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=6 ttl=117 time=4.81 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=7 ttl=117 time=4.77 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=8 ttl=117 time=4.79 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=9 ttl=117 time=4.98 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=10 ttl=117 time=4.81 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=11 ttl=117 time=4.77 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=12 ttl=117 time=4.78 ms
^C
--- g.cn ping statistics ---
12 packets transmitted, 12 received, 0% packet loss, time 2210ms
rtt min/avg/max/mdev = 4.760/4.820/5.045/0.123 ms, ipg/ewma 200.918/4.862 ms
[purpleendurer @ bash ~] 

 

可以看到,ping -A 返回个信息的速度明显快于  ping -a。

1.3 ping -b  g.cn:使用广播方式ping g.cn

[purpleendurer @ bash ~] ping -b  g.cn
PING g.cn (114.250.70.34) 56(84) bytes of data.
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=1 ttl=117 time=4.83 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=2 ttl=117 time=4.81 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=3 ttl=117 time=4.80 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=4 ttl=117 time=4.76 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=5 ttl=117 time=4.80 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=6 ttl=117 time=4.86 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=7 ttl=117 time=4.80 ms
^C
--- g.cn ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6011ms
rtt min/avg/max/mdev = 4.766/4.813/4.862/0.095 ms
[purpleendurer @ bash ~] 

 

1.4 ping -B  g.cn

[purpleendurer @ bash ~] ping -B  g.cn
PING g.cn (114.250.67.34) from 172.25.109.185 : 56(84) bytes of data.
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=1 ttl=116 time=4.01 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=2 ttl=116 time=4.36 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=3 ttl=116 time=3.94 ms
^C
--- g.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 3.943/4.108/4.364/0.197 ms
[purpleendurer @ bash ~] 

 

 

1.5 ping -c 2 g.cn:向g.cn发送2个ICMP包

[purpleendurer @ bash ~] ping -c 2 g.cn
PING g.cn (114.250.70.34) 56(84) bytes of data.
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=1 ttl=117 time=4.82 ms
64 bytes from 114.250.70.34 (114.250.70.34): icmp_seq=2 ttl=117 time=4.82 ms--- g.cn ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 4.822/4.822/4.822/0.000 ms
[purpleendurer @ bash ~] 

 

1.6 ping -d  g.cn

[purpleendurer @ bash ~] ping -d  g.cn
PING g.cn (114.250.67.34) 56(84) bytes of data.
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=1 ttl=116 time=3.95 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=2 ttl=116 time=3.97 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=3 ttl=116 time=3.92 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=4 ttl=116 time=3.89 ms
64 bytes from 114.250.67.34 (114.250.67.34): icmp_seq=5 ttl=116 time=3.92 ms
^C
--- g.cn ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 3.896/3.933/3.976/0.062 ms
[purpleendurer @ bash ~] 

 

1.7 ping -f g.cn:洪水 ping g.cn (只有超级用户才能使用此选项)

[purpleendurer @ bash ~] ping -f g.cn
PING g.cn (114.250.67.34) 56(84) bytes of data.
ping: cannot flood; minimal interval allowed for user is 200ms
[purpleendurer @ bash ~] sudo ping -f g.cn
PING g.cn (114.250.65.34) 56(84) bytes of data.
.^C
--- g.cn ping statistics ---
5304 packets transmitted, 5303 received, 0% packet loss, time 28698ms
rtt min/avg/max/mdev = 5.285/5.390/12.965/0.268 ms, pipe 2, ipg/ewma 5.411/5.371 ms
[purpleendurer @ bash ~] 

1.8 ping -i 2 -c 3 g.cn:间隔2秒钟向g.cn发送3个ICMP包

[purpleendurer @ bash ~] ping -i 2 -c 3 g.cn
PING g.cn (114.250.65.34) 56(84) bytes of data.
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=1 ttl=117 time=5.49 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=2 ttl=117 time=5.38 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=3 ttl=117 time=5.40 ms--- g.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 5.389/5.428/5.491/0.096 ms
[purpleendurer @ bash ~] 

 

1.9 ping -q g.cn :以静默方式ping g.cn

[purpleendurer @ bash ~] ping -q g.cn
PING g.cn (114.250.65.34) 56(84) bytes of data.
^C
--- g.cn ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7010ms
rtt min/avg/max/mdev = 5.386/5.410/5.453/0.023 ms
[purpleendurer @ bash ~] 

 

命令返回的信息除了启动时和完成时的总结行外,不显示任何内容。 

1.10 ping -s 99 g.cn:以99个字节ping g.cn

[purpleendurer @ bash ~] ping -s 99 g.cn
PING g.cn (114.250.65.34) 99(127) bytes of data.
107 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=1 ttl=117 time=5.43 ms
107 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=2 ttl=117 time=5.44 ms
107 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=3 ttl=117 time=5.39 ms
^C
--- g.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 5.396/5.427/5.449/0.088 ms
[purpleendurer @ bash ~] 

 

1.11 ping -t 16 g.cn: 以TTL 值为16向g.cn发送ICMP包

[purpleendurer @ bash ~] ping -t 16 g.cn
PING g.cn (114.250.65.34) 56(84) bytes of data.
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=1 ttl=117 time=5.39 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=2 ttl=117 time=5.40 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=3 ttl=117 time=5.38 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=4 ttl=117 time=5.39 ms
^C
--- g.cn ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 5.382/5.393/5.407/0.090 ms
[purpleendurer @ bash ~] 

 1.12 ping -T <时间戳>  g.cn:设置特殊的 IP 时间戳选项来ping g.cn

[purpleendurer @ bash ~] ping -T tsandaddr  g.cn
PING g.cn (114.250.66.34) 56(124) bytes of data.
^C
--- g.cn ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7166ms[purpleendurer @ bash ~] ping -T tsonly  g.cn
PING g.cn (114.250.66.34) 56(124) bytes of data.
^C
--- g.cn ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4091ms[purpleendurer @ bash ~] 

 

1.13 ping -v g.cn:启用详细模式ping g.cn

[purpleendurer @ bash ~] ping -v g.cn
PING g.cn (114.250.65.34) 56(84) bytes of data.
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=1 ttl=117 time=5.51 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=2 ttl=117 time=5.40 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=3 ttl=117 time=5.37 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=4 ttl=117 time=5.45 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=5 ttl=117 time=5.35 ms
64 bytes from 114.250.65.34 (114.250.65.34): icmp_seq=6 ttl=117 time=5.41 ms
^C
--- g.cn ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 5.358/5.420/5.516/0.100 ms
[purpleendurer @ bash ~] 

 

好像没有显示什么更详细的信息 

3 参考资料

 ping(8) - Linux man page (die.net)

相关文章:

Linux shell编程学习笔记66:ping命令 超详细的选项说明

0 前言 网络信息是电脑网络信息安全检查中的一块重要内容&#xff0c;Linux和基于Linux的操作系统&#xff0c;提供了很多的网络命令&#xff0c;今天我们研究最常用的ping命令。 1 ping命令 的功能、格式和选项说明 1.1 ping命令 的功能 简单来说&#xff0c; ping 命令 会…...

SSL/TLS和SSL VPN

1、SSL/TLS SSL安全套接字层&#xff1a;是一种加密协议&#xff0c;用于在网络通信中建立安全连接。它在应用层和传输层&#xff08;TCP/IP&#xff09;之间提供数据加密、服务器身份验证以及信息完整性验证 SSL只保护TCP流量&#xff0c;不保护UDP协议 TLS&#xff1a;传输层…...

浅谈WebSerice

一. 什么是WebService Web Service也称为web服务&#xff0c;它是一种跨编程语言和操作系统平台的远程调用技术。Web Service采用标准的SOAP协议传输&#xff08;SOAP&#xff1a;Simple Object Access Protocol简单对象访问协议&#xff0c;soap属于w3c标准。并且soap协议是基…...

linux快速入门-学习笔记

linux快速入门-学习笔记 第一章&#xff1a;Linux系统概念及命令学习Linux系统基本概念命令终端介绍命令格式介绍Linux系统辨别目录与文件的方法通过文件详细属性辨别ls 查看目录/文件命令Linux 系统下的归属关系命令行编辑技巧Linux 基本权限的类别课后练习 第二章&#xff1a…...

科普文:5种Linux下软件部署方式说明

在Linux世界里&#xff0c;高效、灵活地安装和管理软件是每个系统管理员和开发者的基本功。从传统的RPM包管理&#xff0c;到便捷的YUM软件仓库&#xff0c;再到颠覆性的Docker容器技术&#xff0c;Snap&#xff0c;源码安装&#xff0c;每一种方法都有其独到之处&#xff0c;适…...

Redisson中的RBlockingQueue的使用场景及例子

Redisson 的 RBlockingQueue 是一个实现了 Java BlockingQueue 接口的分布式队列&#xff0c;它可以用于在分布式系统中实现生产者-消费者模式。RBlockingQueue 提供了线程安全的阻塞队列操作&#xff0c;允许生产者在队列满时阻塞&#xff0c;消费者在队列空时阻塞&#xff0c…...

【办公软件】Office 2019以上版本PPT 做平滑切换

Office2019以上版本可以在切页面时做平滑切换&#xff0c;做到一些简单的动画效果。如下在快捷菜单栏中的切换里选择平滑。 比如&#xff0c;在两页PPT中&#xff0c;使用同一个形状对象&#xff0c;修改了大小和颜色。 选择切换为平滑后&#xff0c;可以完成如下的动画显示。 …...

connect-multiparty中间件用法以及实例--文件上传中间件(保姆级别教学)

connect-multiparty中间件的用法包括安装和引入、基本设置、路由应用、文件处理以及安全和优化等步骤。 connect-multiparty是一个专为Connect和Express框架设计的文件上传中间件&#xff0c;它基于multiparty库&#xff0c;用于处理多部分表单数据&#xff0c;尤其针对文件上传…...

0503触发器的电路结构和工作原理

触发器的电路结构和工作原理 如何区分锁存器还是触发器&#xff0c; 看有没有这个三角符号&#xff0c;告诉是上升沿触发还是下降沿触发&#xff0c;没有三角符号就是电平触发。低电平触发就画个小圈。高电平触发就不画小圈。有小圈的三角就是下降沿触发 setup建立时间 hold 保…...

LeetCode:二叉树的中序遍历(C语言)

1、前序遍历&#xff1a;根左右 2、中序遍历&#xff1a;左根右 3、后序遍历&#xff1a;左右根 1、问题概述&#xff1a;二叉树中序遍历 2、示例 示例 1&#xff1a; 输入&#xff1a;root [1,null,2,3] 输出&#xff1a;[1,3,2] 示例 2&#xff1a; 输入&#xff1a;root […...

MySQL数据库基本安装与部署

目录 概念 数据库的基本概念 关系型数据库 非关系型数据库 MySQL 商业版与社区版 示例 初始化MySQL 添加系统服务 概念 数据库的基本概念 数据&#xff08;Data&#xff09; 描述事物的符号记录包括数字、文字、图形、图像、声音、档案记录等以“记录”形式按统一的…...

paraFoam 运行 报错 usr/lib/x86_64-linux-gnu/libQt5Core.so 已解决

在日常项目开发中。使用ubuntu 视图开发的时候。报错 缺少 libQt5Core 核心组件&#xff01; whereis libQt5Core.so.5sudo strip --remove-section.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 完美解决&#xff0c;并且能正常打开&#xff0c;前提是&#xff0c…...

科技前沿:Llama 3.1的突破与革新

在科技的长河中&#xff0c;每一次模型的更新都是对人类智慧的致敬。今天&#xff0c;我们将聚焦于Meta公司最新发布的Llama 3.1系列模型&#xff0c;探索其在AI领域的前沿突破。 新模型的诞生 自去年以来&#xff0c;Meta公司不断推进人工智能技术的发展&#xff0c;终于在近…...

每天一个数据分析题(四百四十七)- 业务系统

业务系统往往因为系统故障、设备故障、人为失误等原因导致数据中存在异常数据&#xff0c;下列哪一项方法对于发现异常值有帮助&#xff08; &#xff09; A. 计算均值加减三倍标准差的范围 B. 梯度下降法 C. 相关性分析 D. 计算四分位距 数据分析认证考试介绍&#xff1a…...

如何保护你的网络安全?

在2024年4月&#xff0c;一次创纪录的DDoS&#xff08;分布式拒绝服务&#xff09;攻击震惊了网络世界&#xff0c;这次攻击达到每秒840百万数据包&#xff08;Mpps&#xff09;。你可能会问&#xff0c;DDoS攻击到底是什么&#xff1f;为什么它这么重要呢&#xff1f; 什么是…...

Nginx 怎样处理请求的重试机制?

&#x1f345;关注博主&#x1f397;️ 带你畅游技术世界&#xff0c;不错过每一次成长机会&#xff01; 文章目录 Nginx 怎样处理请求的重试机制&#xff1f;一、为何需要重试机制&#xff1f;二、Nginx 中的重试机制原理三、Nginx 重试机制的配置参数四、Nginx 重试机制的实际…...

自己开发软件实现网站抓取m3u8链接

几天前一个同学说想下载一个网站的视频找不到连接&#xff0c;问我有没有什么办法,网站抓取m3u8链接 网页抓取m3u8链接。当时一听觉得应该简单&#xff0c;于是说我抽空看看。然后就分析目标网页&#xff0c;试图从网页源码里找出连接&#xff0c;有的源代码直接有,但是有的没有…...

[Python3] 多模式字符串搜索 `Aho-Corasick`

ahocorasick.Automaton 是 Python 中 pyahocorasick 库提供的一个类&#xff0c;用于实现 Aho-Corasick 自动机。Aho-Corasick 算法是一种用于精确或近似多模式字符串搜索的高效算法。 通过 pip install pyahocorasick 安装 pyahocorasick 库。 并且&#xff0c;该模块是用 C 编…...

4 Types of Kaggle Competitions

1---Featured Competitions&#x1f911;&#x1f911; These are comprehensive Machine Learning challenges posed by difficult, often business-oriented predictive problems. For example, 1⃣️Using customers history of buying insurance to predict the price t…...

【STM32】stm32中GPIO_ReadInputDataBit()是什么意思

GPIO_ReadInputDataBit()函数用于读取指定GPIO端口的某一引脚上的电平状态&#xff0c;并返回该引脚的电平是高电平&#xff08;1&#xff09;还是低电平&#xff08;0&#xff09;。 在STM32单片机中&#xff0c;GPIO&#xff08;General-Purpose Input/Output&#xff09;端…...

Java 语言特性(面试系列2)

一、SQL 基础 1. 复杂查询 &#xff08;1&#xff09;连接查询&#xff08;JOIN&#xff09; 内连接&#xff08;INNER JOIN&#xff09;&#xff1a;返回两表匹配的记录。 SELECT e.name, d.dept_name FROM employees e INNER JOIN departments d ON e.dept_id d.dept_id; 左…...

QT: `long long` 类型转换为 `QString` 2025.6.5

在 Qt 中&#xff0c;将 long long 类型转换为 QString 可以通过以下两种常用方法实现&#xff1a; 方法 1&#xff1a;使用 QString::number() 直接调用 QString 的静态方法 number()&#xff0c;将数值转换为字符串&#xff1a; long long value 1234567890123456789LL; …...

JVM 内存结构 详解

内存结构 运行时数据区&#xff1a; Java虚拟机在运行Java程序过程中管理的内存区域。 程序计数器&#xff1a; ​ 线程私有&#xff0c;程序控制流的指示器&#xff0c;分支、循环、跳转、异常处理、线程恢复等基础功能都依赖这个计数器完成。 ​ 每个线程都有一个程序计数…...

C/C++ 中附加包含目录、附加库目录与附加依赖项详解

在 C/C 编程的编译和链接过程中&#xff0c;附加包含目录、附加库目录和附加依赖项是三个至关重要的设置&#xff0c;它们相互配合&#xff0c;确保程序能够正确引用外部资源并顺利构建。虽然在学习过程中&#xff0c;这些概念容易让人混淆&#xff0c;但深入理解它们的作用和联…...

在树莓派上添加音频输入设备的几种方法

在树莓派上添加音频输入设备可以通过以下步骤完成&#xff0c;具体方法取决于设备类型&#xff08;如USB麦克风、3.5mm接口麦克风或HDMI音频输入&#xff09;。以下是详细指南&#xff1a; 1. 连接音频输入设备 USB麦克风/声卡&#xff1a;直接插入树莓派的USB接口。3.5mm麦克…...

Kubernetes 网络模型深度解析:Pod IP 与 Service 的负载均衡机制,Service到底是什么?

Pod IP 的本质与特性 Pod IP 的定位 纯端点地址&#xff1a;Pod IP 是分配给 Pod 网络命名空间的真实 IP 地址&#xff08;如 10.244.1.2&#xff09;无特殊名称&#xff1a;在 Kubernetes 中&#xff0c;它通常被称为 “Pod IP” 或 “容器 IP”生命周期&#xff1a;与 Pod …...

针对药品仓库的效期管理问题,如何利用WMS系统“破局”

案例&#xff1a; 某医药分销企业&#xff0c;主要经营各类药品的批发与零售。由于药品的特殊性&#xff0c;效期管理至关重要&#xff0c;但该企业一直面临效期问题的困扰。在未使用WMS系统之前&#xff0c;其药品入库、存储、出库等环节的效期管理主要依赖人工记录与检查。库…...

react菜单,动态绑定点击事件,菜单分离出去单独的js文件,Ant框架

1、菜单文件treeTop.js // 顶部菜单 import { AppstoreOutlined, SettingOutlined } from ant-design/icons; // 定义菜单项数据 const treeTop [{label: Docker管理,key: 1,icon: <AppstoreOutlined />,url:"/docker/index"},{label: 权限管理,key: 2,icon:…...

「Java基本语法」变量的使用

变量定义 变量是程序中存储数据的容器&#xff0c;用于保存可变的数据值。在Java中&#xff0c;变量必须先声明后使用&#xff0c;声明时需指定变量的数据类型和变量名。 语法 数据类型 变量名 [ 初始值]; 示例&#xff1a;声明与初始化 public class VariableDemo {publi…...

用鸿蒙HarmonyOS5实现国际象棋小游戏的过程

下面是一个基于鸿蒙OS (HarmonyOS) 的国际象棋小游戏的完整实现代码&#xff0c;使用Java语言和鸿蒙的Ability框架。 1. 项目结构 /src/main/java/com/example/chess/├── MainAbilitySlice.java // 主界面逻辑├── ChessView.java // 游戏视图和逻辑├── …...