Home >System Tutorial >LINUX >Functions of the ping command and differences between Linux and Windows systems

Functions of the ping command and differences between Linux and Windows systems

WBOY
WBOYOriginal
2024-06-26 07:31:20644browse

ping 命令的功能及在 Linux 和 Windows 系统中的差异

The function of the ping command is to test the network connectivity between hosts, send out data packets based on the ICMP transmission contract linux network delay test, and require the other host to reply. If the other host’s network function does not If there is a problem and the firewall allows the traffic, the message will be replied, and we will know that the other party's host system is online and running normally.

However, it is worth noting that there are certain differences between Linux and Windows. The ping command under the Windows system will send out 4 requests and then manually terminate the command; while the Linux system will not terminate manually and requires the user to automatically press the key combination. "Ctrl+c" can be used to end, or add the -c parameter when initiating the command to limit the number of messages sent.

Test environment: Centos7.6 system - Server from: Lanyi Cloud

Taiwan’s five-network CN2 network has excellent speed abroad and supports VPC external network interconnection, snapshots, backup and other functions.

China Unicom + China Mobile + China Netcom + Education Network + Radio and Television - Five Networks CN2 - Super low delay!

Detailed review article: click here to view

Sentence format: ping[parameter] target host

Commonly used parameters:

-d uses the SO_DEBUG function of Socket

-c

Specify the number of times to send messages

-i

Specify the interval between sending and receiving messages

linux 网络延迟测试_测试网络延迟命令_linux测试网络延迟

-I

Use the designated network socket to send data packets

-l

Set the data package to be sent first before sending the requested information

-n

Only output numerical values

linux测试网络延迟_测试网络延迟命令_linux 网络延迟测试

-p

Set a template style filled with packets

-q

Do not display the instruction execution process

-R

Record routing process

-s

Set the packet size

-t

Set the size of the survival value TTL

-v

Display the execution process of the command in detail

Reference examples

Test the network connectivity with the specified website server (you need to automatically press the "Ctrl+c" key combination to end the command):

C:WindowsSystem32>ping www.tsyvps.com
正在 Ping www.tsyvps.com [112.192.19.252] 具有 32 字节的数据:
来自 112.192.19.252 的回复: 字节=32 时间=13ms TTL=50
来自 112.192.19.252 的回复: 字节=32 时间=9ms TTL=50
来自 112.192.19.252 的回复: 字节=32 时间=9ms TTL=50
来自 112.192.19.252 的回复: 字节=32 时间=9ms TTL=50
112.192.19.252 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 9ms,最长 = 13ms,平均 = 10ms

Test the network connectivity with the designated website serverlinux network delay test, sending request packets is limited to 4 times:

[root@linuxcool ~]# ping -c 4 www.tsyvps.com
PING www.tsyvps.com (112.192.19.252) 56(84) bytes of data.
64 bytes from www.tsyvps.com (112.192.19.252): icmp_seq=1 ttl=52 time=24.7 ms
64 bytes from www.tsyvps.com (112.192.19.252): icmp_seq=2 ttl=52 time=24.7 ms
64 bytes from www.tsyvps.com (112.192.19.252): icmp_seq=3 ttl=52 time=24.7 ms
64 bytes from www.tsyvps.com (112.192.19.252): icmp_seq=4 ttl=52 time=24.7 ms
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 24.658/24.664/24.673/0.111 ms

Test the network connectivity with the specified host, send the request packet 3 times, Linux operating system principle, each time interval is 0.2 seconds, the maximum waiting time is 3 seconds:

[root@linuxcool ~]# ping -c 3 -i 0.2 -W 3 192.168.10.10
64 bytes from 192.168.10.10: icmp_seq=1 ttl=64 time=0.166 ms
64 bytes from 192.168.10.10: icmp_seq=2 ttl=64 time=0.060 ms
64 bytes from 192.168.10.10: icmp_seq=3 ttl=64 time=0.113 ms
--- 192.168.10.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 410ms
rtt min/avg/max/mdev = 0.060/0.113/0.166/0.043 ms

The above is the detailed content of Functions of the ping command and differences between Linux and Windows systems. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn