Hi,
I want to share below ping command options both for huawei vrp system and windows os
ping [ -a source-ip-address | -i interface-type interface-number | -m time | -c count | -f | -h ttl-value | { -s packetsize | -range [ min min-size | max max-size | step step-size ] * } | -t timeout ] *host
-a: specifies a source IP address for sending ICMP Echo Request packets. If this parameter is not specified, the device uses the IP address of the outbound interface as the source IP address of outgoing Echo Request packets.
-i: specifies an interface for sending ICMP Echo Request packets. If this parameter is not specified, the device uses the default outbound interface to send Echo Request packets.
-m: specifies the interval for sending Echo Request packets. The default value is 500 ms.
-c: specifies the number of Echo Request packets to be sent. The default value is 5. You can increase the number of outgoing Echo Request packets to obtain the packet loss ratio and further evaluate network quality.
-f: indicates that packets are not fragmented. After this parameter is specified, ICMP packets are not fragmented. If the ICMP packet size exceeds the link MTU, the ICMP packet is discarded. If you do not want ICMP packets to be discarded, do not specify this parameter or increase the link MTU.
-h: specifies the time to live (TTL) value. The default value is 255. If the value of the TTL field is reduced to 0 during packet forwarding, the device sends an ICMP Timeout packet to the source, indicating that the destination is unreachable.
-s: specifies the length of an ICMP Echo Request packet (excluding the IP packet header and ICMP packet header). The default packet length is 56 bytes.
-range: specifies the length of an ICMP Echo Request packet (excluding the IP packet header and ICMP packet header) and the packet length increment (step). If this parameter is specified, the length of the first packet is min, and the length of subsequent packets increases by step until the packet length reaches the maximum value max. By default, min is 56 bytes, max is 9600 bytes, and step is 1 byte.
min: specifies the minimum length of the payload in an ICMP Echo Request packet. The default value is 56 bytes.
max: specifies the maximum length of the payload in an ICMP Echo Request packet. The default value is 9600 bytes.
step: specifies the packet length increment. The default value is 1 byte.
-t: specifies the timeout period for an ICMP Echo Reply packet. The default value is 2000 ms. The device considers that the destination is unreachable if it does not receive an ICMP Echo Reply packet within the timeout period. You can set this parameter to a larger value to compensate for poor network quality.
host: specifies the domain name or IP address of the destination host.
The ping command provides a series of parameters. You can select different parameters by factors such as the detection purpose, network type, and network status.
Ping Command Supported on a PC
The ping command differs on PCs running different operating systems. The following describes the commonly used ping parameters supported on a Windows-based PC.
ping [ -a | -n number | -l number | -t | -f ] * ip-address
-a: indicates that the PC resolves an IP address to a host name.
-n: specifies the number of Echo Request packets to be sent.
-l: specifies the buffer size.
-t: indicates that the ping process continues until manual operations are performed. You can press Ctrl+Break to pause the ping command and view the statistics, or press Ctrl+C to terminate the running of the ping command.
-f: indicates that packets are not fragmented.
ip-address: specifies the IP address of the destination host.
Ping Example
The following describes ping commands on a switch.
Example of ping failure:
<SwitchA> ping 192.168.2.25
PING 192.168.2.25: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 192.168.2.25 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
Example of ping success:
<SwitchA> ping -a 192.168.2.20 -c 7 -s 2048 192.168.2.21
PING 192.168.2.21: 2048 data bytes, press CTRL_C to break
Reply from 192.168.2.21: bytes=2048 Sequence=1 ttl=255 time=24 ms
Reply from 192.168.2.21: bytes=2048 Sequence=2 ttl=255 time=6 ms
Reply from 192.168.2.21: bytes=2048 Sequence=3 ttl=255 time=13 ms
Reply from 192.168.2.21: bytes=2048 Sequence=4 ttl=255 time=6 ms
Reply from 192.168.2.21: bytes=2048 Sequence=5 ttl=255 time=12 ms
Reply from 192.168.2.21: bytes=2048 Sequence=6 ttl=255 time=6 ms
Reply from 192.168.2.21: bytes=2048 Sequence=7 ttl=255 time=13 ms
--- 192.168.2.21 ping statistics ---
7 packet(s) transmitted
7 packet(s) received
0.00% packet loss
round-trip min/avg/max = 6/11/24 ms