Linux下ping命令参数详细解析
2022/7/26 5:24:01
本文主要是介绍Linux下ping命令参数详细解析,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
出处:https://www.bbsmax.com/A/KE5QgpVjzL/ -a Audible ping. #Audible ping. -A Adaptive ping. Interpacket interval adapts to round-trip time, so that effectively not more than one (or more, if preload is set) unanswered probe is present in the network. Minimal interval is 200msec for not super-user. On networks with low rtt this mode is essentially equiva‐ lent to flood mode. #自适应ping,根据ping包往返时间确定ping的速度 -b Allow pinging a broadcast address. #允许ping一个广播地址 -B Do not allow ping to change source address of probes. The address is bound to one selected when ping starts. #不允许ping改变包头的源地址 -c count Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires. #ping指定次数后停止ping -d Set the SO_DEBUG option on the socket being used. Essentially, this socket option is not used by Linux kernel. #使用Socket的SO_DEBUG功能 -D Print timestamp (unix time + microseconds as in gettimeofday) before each line. #打印时间戳 -f Flood ping. For every ECHO_REQUEST sent a period ``.'' is printed, while for ever ECHO_REPLY received a backspace is printed. This pro‐ vides a rapid display of how many packets are being dropped. 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. Only the super-user may use this option with zero interval. #极限检测,快速连续ping一台主机,ping的速度达到100次每秒 -F flow label ping6 only. Allocate and set bit flow label (in hex) on echo request packets. If value is zero, kernel allocates random flow label. #为ping回显请求分配一个20位的“flow label”,如果未设置,内核会为ping随机分配 -h Show help. #显示帮助 -i interval Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 sec‐ onds. #设定间隔几秒发送一个ping包,默认一秒ping一次 -I interface interface is either an address, or an interface name. If interface is an address, it sets source address to specified interface address. If interface in an interface name, it sets source interface to specified interface. For ping6, when doing ping to a link-local scope address, link specification (by the '%'-notation in destination, or by this option) is required. #指定网卡接口、或指定的本机地址送出数据包 -l preload If preload is specified, ping sends that many packets not waiting for reply. Only the super-user may select preload more than . #设置在送出要求信息之前,先行发出的数据包 -L Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast address. #抑制组播报文回送,只适用于ping的目标为一个组播地址 -m mark use mark to tag the packets going out. This is useful for variety of reasons within the kernel such as using policy routing to select spe‐ cific outbound processing. #设置mark -n Numeric output only. No attempt will be made to lookup symbolic names for host addresses. #不要将ip地址转换成主机名 -O Report outstanding ICMP ECHO reply before sending next packet. This is useful together with the timestamp -D to log output to a diagnostic file and search for missing answers. #在发送下一个包之前报告未完成的ICMP回复,这与时间戳-D一起记录诊断输出 -p pattern You may specify up to ``pad'' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a net‐ work. For example, -p ff will cause the sent packet to be filled with all ones. #指定填充ping数据包的十六进制内容,在诊断与数据有关的网络错误时这个选项就非常有用,如:“-p ff” -q Quiet output. Nothing is displayed except the summary lines at startup time and when finished. -Q tos Set Quality of Service -related bits in ICMP datagrams. tos can be decimal (ping only) or hex number. #不显示任何传送封包的信息,只显示最后的结果 -r Bypass the normal routing tables and send directly to a host on an attached interface. If the host is not on a directly-attached net‐ work, an error is returned. 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. #忽略正常的路由表,直接将数据包送到远端主机上,通常是查看本机的网络接口是否有问题;如果主机不直接连接的网络上,则返回一个错误 -R ping only. Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. Note that the IP header is only large enough for nine such routes. Many hosts ignore or discard this option. #记录ping的路由过程(IPv4 only) -s packetsize Specifies the number of data bytes to be sent. The default is , which translates into ICMP data bytes when combined with the bytes of ICMP header data. #指定每次ping发送的数据字节数,默认为“56字节”+“28字节”的ICMP头,一共是84字节 -S sndbuf Set socket sndbuf. If not specified, it is selected to buffer not more than one packet. #指定每次ping发送的数据字节数,默认为“56字节”+“28字节”的ICMP头,一共是84字节 #包头+内容不能大于65535,所以最大值为65507(linux:, windows:) -t ttl ping only. Set the IP Time to Live. #设置TTL(Time To Live)为指定的值。该字段指定IP包被路由器丢弃之前允许通过的最大网段数 -T timestamp option Set special IP timestamp options. timestamp option may be either tsonly (only timestamps), tsandaddr (timestamps and addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified hops). #设置IP timestamp选项,可以是下面的任何一个:'tsonly' (only timestamps)'tsandaddr' (timestamps and addresses)'tsprespec host1 [host2 [host3]]' (timestamp prespecified hops) -U Print full user-to-user latency (the old behaviour). Normally ping prints network round trip time, which can be different f.e. due to DNS failures. #打印完整的用户到用户延迟(旧的行为)。通常平打印网络往返时间,由于DNS不同,可能会有不同的f.e.失败。 -v Verbose output. #使ping处于verbose方式,它要ping命令除了打印ECHO-RESPONSE数据包之外,还打印其它所有返回的ICMP数据包 -V Show version and exit. #显示版本并退出 -w deadline Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. 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. #在ping退出之前指定超时(以秒为单位),无论如何许多包已经发送或接收。在这种情况下ping不会计数包发送后停止,它等待最后期限过期或者直到计数探测得到应答或来自某个错误通知网络。 -W timeout Time to wait for a response, in seconds. The option affects only time‐ out in absence of any responses, otherwise ping waits for two RTTs. #等待响应的时间,以秒计。该选项只影响时间在没有任何响应的情况下退出,否则ping将等待两个rtt。
这篇关于Linux下ping命令参数详细解析的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-12如何创建可引导的 ESXi USB 安装介质 (macOS, Linux, Windows)
- 2024-11-08linux的 vi编辑器中搜索关键字有哪些常用的命令和技巧?-icode9专业技术文章分享
- 2024-11-08在 Linux 的 vi 或 vim 编辑器中什么命令可以直接跳到文件的结尾?-icode9专业技术文章分享
- 2024-10-22原生鸿蒙操作系统HarmonyOS NEXT(HarmonyOS 5)正式发布
- 2024-10-18操作系统入门教程:新手必看的基本操作指南
- 2024-10-18初学者必看:操作系统入门全攻略
- 2024-10-17操作系统入门教程:轻松掌握操作系统基础知识
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南
- 2024-08-21【Linux】分区向左扩容的方法