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

news2024/9/20 8:40:25

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)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1944081.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

编写SpringBoot的自定义starter包

starter项目 先来看一下Starter的官方解释&#xff1a; Spring Boot Starter 是一种方便的依赖管理方式&#xff0c;它封装了特定功能或技术栈的所有必要依赖项和配置&#xff0c;使得开发者可以快速地将这些功能集成到Spring Boot项目中。Spring Boot官方提供了一系列的Star…

首次 Cloudberry Database 社区聚会 · 北京站,8月3日,诚邀

近期 Greenplum 源码归档及走向闭源在圈内讨论火热&#xff0c;原有开源用户面临断档风险。作为 Greenplum 衍生版和开源替代&#xff0c;Cloudberry Database 由原厂核心开发者打造&#xff0c;与其保持兼容&#xff0c;并且具备更新内核和更丰富功能。Cloudberry Database 逐…

代理协议解析:如何根据需求选择HTTP、HTTPS或SOCKS5?

代理IP协议是一种网络代理技术&#xff0c;可以实现隐藏客户端IP地址、加速网站访问、过滤网络内容、访问内网资源等功能。常用的IP代理协议主要有Socks5代理、HTTP代理、HTTPS代理这三种。代理IP协议主要用于分组交换计算机通信网络的互联系统中使用&#xff0c;只负责数据的路…

【MATLAB实战】基于UNet的肺结节的检测

数据&#xff1a; 训练过程图 算法简介&#xff1a; UNet网络是分割任务中的一个经典模型,因其整体形状与"U"相似而得名,"U"形结构有助于捕获多尺度信息,并促进了特征的精确重建&#xff0c;该网络整体由编码器,解码器以及跳跃连接三部分组成。 编码器由…

UE4/5 对话系统

参考教程&#xff1a;UE4甜筒教艺术生学蓝图#21.UE4对话系统(1)--唠嗑案例展示_哔哩哔哩_bilibili 说来惭愧两年前看的教程&#xff0c;现在才记录一下&#xff0c;很好的教程推荐大家观看 1.首先创建两个枚举&#xff0c;内容如下 2.创建三个结构体&#xff0c;内容如下 3.再…

SSRF:服务端请求伪造

SSRF漏洞原理 SSRF漏洞通常是因为服务端应用程序提供了从其他服务器获取数据的功能&#xff0c;但未对目标地址或协议进行适当的过滤和限制。攻击者可以通过这个漏洞发送构造好的恶意请求&#xff0c;让服务器以自己的身份去访问其他资源&#xff0c;与文件包含漏洞有些许相似…

遍历dom元素下面的子元素的方法,vue中原始标签的ref得到是该元素的dom及下面包含的子dom,与组件ref是引用不同

研究到这个的目的来源是 想用div 遍历方式 替代之前的table tr td 那种框选功能&#xff0c;觉得div灵活&#xff0c;可以随便在外面套层&#xff0c;td与tr之间就不能加div加了布局就乱&#xff0c;然后使用之前的原理&#xff08; const cellList tableIdR.value.querySelec…

Caché 数据库摘要与手册索引

因为设置了 VIP 可见,对于无法直接阅读该篇博客的,建议直接阅读官方博客,链接如下: Cach & Ensemble 2018.1.4 – 2018.1.9 | Documentation Home Page (intersystems.com)https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls 目录 一、简介 0、…

【Socket 编程】应用层自定义协议与序列化

文章目录 再谈协议序列化和反序列化理解 read、write、recv、send 和 tcp 为什么支持全双工自定义协议网络计算器序列化和反序列化 再谈协议 协议就是约定&#xff0c;协议的内容就是约定好的某种结构化数据。比如&#xff0c;我们要实现一个网络版的计算器&#xff0c;客户端…

掌握互联网路由选择协议:从基础入门到实战

文章目录 路由选择协议的基本概念路由选择算法的分类分层次的路由选择协议路由信息协议&#xff08;RIP&#xff09;内部网关协议&#xff1a;OSPF外部网关协议&#xff1a;BGP互联网中的实际应用总结 互联网的路由选择协议是网络通信的核心&#xff0c;它决定了数据包如何在网…

Artix7系列FPGA实现SDI视频编解码+图像缩放+多路视频拼接,基于GTP高速接口,提供4套工程源码和技术支持

目录 1、前言工程概述免责声明 2、相关方案推荐本博已有的 SDI 编解码方案本博已有的FPGA图像缩放方案本博已有的已有的FPGA视频拼接叠加融合方案本方案的无缩放应用本方案在Xilinx--Kintex系列FPGA上的应用本方案在Xilinx--Zynq系列FPGA上的应用 3、详细设计方案设计原理框图S…

nodejs编译报错 集合

目录 一、使用命令编译typescript时报错&#xff0c;报错文件tsconfig.json 二、npm start运行后报错&#xff0c;could not find module 一、使用命令编译typescript时报错&#xff0c;报错文件tsconfig.json npx tsc 报错&#xff1a; Specified include paths were [&…

Layer2区块链扩容方案(1)——总述

写在前面 这篇文章作为一个简单介绍&#xff0c;很多技术只是大致提及或者引用&#xff0c;之后会在详细学习后逐项解释。 补充知识 在了解扩容方案之前&#xff0c;我们最好了解一些相关的知识概念 EVM “EVM” 是“Ethereum Virtual Machine”&#xff08;以太坊虚拟机&…

SSRF学习笔记

1.NAT学习 Nat&#xff08;Network Address Translation&#xff0c;网络地址转换&#xff09;是 一种网络通信技术主要用于将私有网络中的内部IP地址转换成公共网络中的公共IP地址&#xff0c;以实现局域网内部设备访问互联网的功能。具体来说&#xff0c;Nat有以下几个主要…

【Emacs有什么优点,用Emacs写程序真的比IDE更方便吗?】

&#x1f3a5;博主&#xff1a;程序员不想YY啊 &#x1f4ab;CSDN优质创作者&#xff0c;CSDN实力新星&#xff0c;CSDN博客专家 &#x1f917;点赞&#x1f388;收藏⭐再看&#x1f4ab;养成习惯 ✨希望本文对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论区提出…

分析性能提升40%,阿里云Hologres流量场景最佳实践

在互联网和移动分析时代&#xff0c;流量数据成为了企业洞察用户行为、优化产品决策和提升运营效率的关键资源。流量数据主要来源于用户在使用APP、小程序或访问网站等媒介平台时产生的各种操作行为&#xff0c;如点击、浏览、注册、下单等。这些行为数据通过数据埋点技术被采集…

Python爬虫技术 第10节 requests库

requests 是 Python 中非常流行的 HTTP 库&#xff0c;它使得发送 HTTP/1.1 请求变得简单直观。下面我会通过几个实际案例来详细介绍如何使用 requests 库。 1. 发送 GET 请求 最简单的请求类型就是 GET 请求&#xff0c;通常用于获取网页或其他资源。 import requests# 发送…

大语言模型-RetroMAE-检索预训练模型

一、背景信息&#xff1a; RetroMAE是2022年10月由北邮和华为提出的一种密集检索预训练策略。 RetroMAE主要应用于检索模型的预训练&#xff0c;模型架构为非对称的Encoder-Decode结构。 二、整体结构&#xff1a; RetroMAE的模型架构为非对称的Encoder-Decode结构。 Encod…

ArcGIS Desktop使用入门(四)——ArcMap软件彻底卸载删除干净

系列文章目录 ArcGIS Desktop使用入门&#xff08;一&#xff09;软件初认识 ArcGIS Desktop使用入门&#xff08;二&#xff09;常用工具条——标准工具 ArcGIS Desktop使用入门&#xff08;二&#xff09;常用工具条——编辑器 ArcGIS Desktop使用入门&#xff08;二&#x…

【逆向工程】十六进制编辑器与反编译的手写PE文件格式(详细教程)

原理 (1)程序如何在本地生成注册码 1.打开文件并写入MZ头部&#xff1a;打开一个二进制文件以进行写入操作。写入MZ头部&#xff0c;即前64字节&#xff0c;通常以字节序列 4D 5A 开始。 2.写入PE头部&#xff1a;PE头部紧随在MZ头部之后&#xff0c;其位置由MZ头部中的偏移…