说明
ping (Packet Internet Groper)是一种因特网包探索器,用于测试网络连接量的程序 。ping是工作在 TCP/IP网络体系结构中应用层的一个服务命令, 主要是向特定的目的主机发送 ICMP(Internet Control Message Protocol 因特网报文控制协议)echo 请求报文,测试目的站是否可达及了解其有关状态。
用法介绍
ping --help
BusyBox v1.29.3 (2021-10-18 08:33:23 UTC) multi-call binary.
Usage: ping [OPTIONS] HOST
Send ICMP ECHO_REQUEST packets to network hosts
-4,-6 Force IP or IPv6 name resolution
-c CNT Send only CNT pings
-s SIZE Send SIZE data bytes in packets (default 56)
-A Ping as soon as reply is recevied
-t TTL Set TTL
-I IFACE/IP Source interface or IP address
-W SEC Seconds to wait for the first response (default 10)
(after all -c CNT packets are sent)
-w SEC Seconds until ping exits (default:infinite)
(can exit earlier with -c CNT)
-q Quiet, only display output at start
and when finished
-p HEXBYTE Pattern to use for payload
使用示例
-c 1:只ping一次
-s 1024:ping 1024bytes的包,默认是56bytes
-I eth0:制定eth0网卡
# ping -c 1 -s 1024 -I eth0 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 1024 data bytes
--- 127.0.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss

bytes 值(字节): 数据包大小,也就是字节。
time 值(时间): 响应时间,这个时间越小,说明你连接这个地址速度越快。
TTL 值: Time To Live, 表示 DNS 记录在 DNS 服务器上存在的时间,它是 IP 协议包的一个值,告诉路由器该数据包何时需要被丢弃。可以通过 Ping 返回的 TTL 值大小,粗略地判断目标系统类型是 Windows 系列还是 UNIX/Linux 系列。
默认情况下,Linux 系统的 TTL 值为 64 或 255,WindowsNT/2000/XP 系统的 TTL 值为 128,Windows98 系统的 TTL 值为 32,UNIX 主机的 TTL 值为 255。
因此一般 TTL 值:
100~130ms 之间,Windows 系统 ;
240~255ms 之间,UNIX/Linux 系统。
ping是TCP/IP网络中用于测试网络连接和主机可达性的工具。它通过发送ICMP echo请求报文并接收回应来衡量延迟和丢包率。本文介绍了ping的用法,如指定数据包大小(-s)、源接口(-I)等,并提供了示例,如仅ping一次(-c1)。此外,还解释了TTL值在网络诊断中的作用,帮助识别目标系统类型。
649

被折叠的 条评论
为什么被折叠?



