ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * | -si { source-interface-name | source-interface-type source-interface-number } } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -q | -r | -vpn-instance vpn-instance-name | -v | -name | -system-time | -ri | -8021p 8021p-value | -detail ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * | -si { source-interface-name | source-interface-type source-interface-number } } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -vpn-instance vpn-instance-name | -name | -8021p 8021p-value | -brief ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * | -si { source-interface-name | source-interface-type source-interface-number } } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | { -vpn-instance vpn-instance-name [ peer peerIpv6 ] } | -8021p 8021p-value | -name | -brief ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * | -si { source-interface-name | source-interface-type source-interface-number } } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -q | -r | { -vpn-instance vpn-instance-name [ peer peerIpv6 ] } | -v | -d | -system-time | -ri | -8021p 8021p-value | -name | -detail ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { -i { interface-name | interface-type interface-number } [ -fri ] } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -vpn-instance vpn-instance-name | -8021p 8021p-value | -name | { -brief | [ -q | -detail | -v | -d | -system-time | -ri ] * } | -service-class classValue ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -q | -r | -vpn-instance vpn-instance-name | -v | -d | -system-time | -ri | -8021p 8021p-value | -name | -detail | -service-class classValue ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { { -i { interface-name | interface-type interface-number } | -nexthop nexthop-address } * } | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -vpn-instance vpn-instance-name | -8021p 8021p-value | -name | -brief | -service-class classValue ] * host [ ip-forwarding ] }
ping [ ip ] { [ -c count | { -s packetsize | -range [ [ min min-value | max max-value | step step-value ] * ] } | -t timeout | -m time | -a source-ip-address | -h ttl-value | -p pattern | { -tos tos-value | -dscp dscp-value } | { -f | ignore-mtu } | -q | -vpn-instance vpn-instance-name | -v | -system-time | -ri | -name ] * host bypass -si { frrSrcIfName | frrSrcIfType frrSrcIfNum } }
Parameter | Description | Value |
---|---|---|
ip |
Specifies the IPv4 protocol. |
The default value is IPv4. |
-c count |
Specifies the maximum number of times for sending ICMP echo request packets. After you run the ping command, the sequence number of an ICMP echo request packet starts from 1 and is incremented by 1 each time an ICMP echo request packet is sent. By default, five ICMP echo request packets are sent. You can use count to specify the number of ICMP echo request packets to be sent. If the peer is reachable, it sends five ICMP Echo Response packets with the same sequence numbers as those of the ICMP echo request packets. In the case of a poor network quality, increase the count value and monitor network quality based on the packet loss ratio. |
The value is an integer ranging from 1 to 4294967295. The default value is 5. |
-i interface-name |
Specifies the interface through which ICMP echo request packets are sent. For broadcast links (on the Ethernet), the specified destination address functions as the next hop address. |
The value is a string of 1 to 63 characters. |
interface-type |
Specifies the type of an interface through which ICMP echo request packets are sent. For broadcast links (on the Ethernet), the specified destination address functions as the next hop address. |
- |
interface-number |
Specifies the number of an interface through which ICMP echo request packets are sent. For broadcast links (on the Ethernet), the specified destination address functions as the next hop address. |
- |
-nexthop nexthop-address |
Specifies an IP address for the next hop. If you have specified this parameter, the device no longer searches the routing table before sending ICMP Echo Response packets. This process prevents ping failures caused by incorrect routing entries. |
The value is in dotted decimal notation.
|
-si source-interface-name |
Specifies the inbound interface name of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
The value is a string of 1 to 63 case-sensitive characters. It cannot contain spaces. |
source-interface-type |
Specifies the inbound interface type of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
- |
source-interface-number |
Specifies the inbound interface number of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
- |
-s packetsize |
Specifies the length of an ICMP Echo Request message (excluding the IP header and ICMP header). |
The value is an integer ranging from 20 to 9600, in bytes. The default value is 56, in bytes. |
-range |
Enables the device to send ICMP echo request messages with variable payload lengths. |
By default, the payload length ranges from 56 to 9600, and the step is 1.
|
min min-value |
Specifies the minimum payload length of an ICMP echo request message. |
The value is an integer ranging from 20 to 9600, in bytes. The default value is 56, in bytes. |
max max-value |
Specifies the maximum payload length of an ICMP echo request message. |
The value is an integer ranging from 20 to 9600, in bytes. The default value is 9600. |
step step-value |
Specifies the step length of an ICMP echo request message. |
The value is an integer in the range from 1 to 1000. The default value is 1. |
-t timeout |
Specifies the timeout period for waiting for an ICMP Echo Reply message after an ICMP Echo Request message is sent. The ping command sends an ICMP Echo Request message to an IP address and waits for an ICMP Echo Reply message. If the ICMP Echo Request message reaches the destination IP address and an ICMP Echo Reply message is sent to the source IP address within the timeout period, the destination IP address is reachable. If no response is received within the timeout period, a timeout message is displayed on the sender. In normal cases, a reply message is received within 1 to 10 seconds after an ICMP Echo Request message is sent. When the network transmission rate is low, you can use this parameter to increase the timeout time of the response to the ICMP Echo Request message. |
The value is an integer ranging from 0 to 65535, in milliseconds. The default value is 2000. |
-m time |
Specifies the time to wait before sending the next ICMP Echo Request message. After sending an ICMP Echo Request message, the device waits for a reply message. By default, the device waits for 500 ms before sending the next ICMP Echo Request message. You can use the time parameter to set the interval at which ICMP Echo Request messages are sent. If network quality is poor, setting this parameter to a value greater than or equal to 2000 ms is recommended. |
The value is an integer ranging from 1 to 10000, in milliseconds. The default value is 500. |
-a source-ip-address |
Specifies the source IP address for ICMP echo request packets. If no source IP address is specified, the IP address of the outbound interface is used. |
The value is in dotted decimal notation. |
-h ttl-value |
Specifies the TTL value. If the TTL value in a packet is reduced to 0 during forwarding, the device that receives the packet sends an ICMP timeout packet to the source, indicating that the destination is unreachable. |
The value is an integer that ranges from 1 to 255. The default value is <b>255</b>. |
-p pattern |
Specifies the padding byte of ICMP echo request packets. The padding byte allows the system to identify a specific packet among a great number of received ICMP Echo Response packets. |
The value is a hexadecimal number ranging from 0 to FFFFFFFF. By default, the padding starts from 0x00. |
-tos tos-value |
Specifies the ToS value of an ICMP echo request packet. The priority of an ICMP packet is determined by the ToS value. |
The value is an integer that ranges from 0 to 255. The default value is 0. |
-dscp dscp-value |
Specifies a DSCP value for ICMP Echo Request messages to be sent. |
The value is an integer in the range from 0 to 63. The default value is <b>0</b>. |
-f |
Indicates that packets are not fragmented during transmission. |
By default, packets will be fragmented during transmission. |
ignore-mtu |
Indicates that the system does not check the interface MTU when a packet is sent. |
- |
-q |
Indicates that only statistics are displayed. By default, all information is displayed. If -q is specified in the ping command, the system displays only statistics about sent and received packets, packet loss ratio, and minimum, average, and maximum RTTs. |
By default, the system displays all information. |
-r |
Records routes. If -r is configured, the IP address of each device that the IP packet passes along the packet transmission path is recorded in the Options field. When the IP packet reaches the destination, all IP addresses recorded in the Options field are copied to an ICMP Echo Response packet. In addition, the IP address of each device that the ICMP Echo Response packet passes through is recorded. When the ping program receives the reply, IP addresses of the passed devices are displayed. |
By default, the route along which an IP packet is forwarded is not recorded. |
-vpn-instance vpn-instance-name |
Specifies the name of a VPN instance. |
The value is a string of 1 to 31 case-sensitive characters. It cannot contain spaces. The VPN instance name cannot be _public_. If spaces are used, the string must be enclosed in double quotation marks ("). |
-v |
Enables the device to display ICMP echo reply packets that are received by but not for this device. For example, a packet times out, or the sequence number of a packet is incorrect.
|
By default, non-user ICMP Echo Reply messages are not displayed. |
-d |
Specifies the SO_DEBUG option on the socket being used. |
- |
-system-time |
Displays the time when ICMP Echo Request packets are sent. |
- |
-ri |
Indicates that the source interface of echo response packet is displayed. |
- |
-8021p 8021p-value |
Specifies the 802.1p value of ICMP Echo Request messages to be sent. |
The value is an integer ranging from 0 to 7. The default value is <b>0</b>. |
-name |
Displays the host name of the destination address. |
- |
-detail |
Displays detailed information about packet loss. |
- |
host |
Specifies the IP address or hostname of a remote system. |
The value is a string of case-sensitive characters and cannot contain spaces. |
ip-forwarding |
Indicates that the ping packets are forcibly forwarded through IP on the first node. |
- |
-brief |
Displays brief information about packet loss. |
- |
peer peerIpv6 |
Specifies a peer SID, that is, the address of the last hop in the SRv6 domain, in EVPN L3VPN over SRv6 BE scenarios. |
The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
-fri |
An echo reply packet is rapidly sent from the specified Eth-Trunk member interface. If the -fri flag is set to true, only an Eth-Trunk member interface can be specified as an outbound interface. In this case, specifying the ri flag is recommended, which facilitates the query of the actual interface that responds to the packets. This function takes effect only in directly connected scenarios where an Eth-Trunk member interface functions as the inbound interface. In scenarios where this function does not take effect, response packets are sent based on the routing table. Fragmented packets do not support fast reply, and therefore the fri flag does not take effect. |
- |
-service-class classValue |
In an SRv6 TE Policy group scenario, you can specify this parameter to select a path. |
The value is of the numerated type, and can be be, af1, af2, af3, af4, ef, cs6, or cs7. |
bypass |
Indicates that packets are sent through the bypass IP path. |
- |
frrSrcIfName |
Specifies the inbound interface name of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
- |
frrSrcIfType |
Specifies the inbound interface type of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
- |
frrSrcIfNum |
Specifies the inbound interface number of ICMP echo request packets to simulate the sending of packets by a remote device. This parameter is set to check faults in the path for forwarding packets received from a specified interface. |
- |
Usage Scenario
Ping is a common debugging tool used to test the network connectivity. It uses ICMP packets to check the following items:
Prerequisites
Configuration Impact
Precautions
<HUAWEI> ping 10.1.1.2
PING 10.1.1.2 : 56 data bytes , press CTRL_C to break
Reply from 10.1.1.2 : bytes=56 sequence=1 ttl=255 time = 1ms
Reply from 10.1.1.2 : bytes=56 sequence=2 ttl=255 time = 2ms
Reply from 10.1.1.2 : bytes=56 sequence=3 ttl=255 time = 1ms
Reply from 10.1.1.2 : bytes=56 sequence=4 ttl=255 time = 3ms
Reply from 10.1.1.2 : bytes=56 sequence=5 ttl=255 time = 2ms
--10.1.1.2 ping statistics--
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/2/3 ms
<HUAWEI> ping -a 1.1.1.1 -c 8 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=6 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=7 ttl=255 time=32 ms
Reply from 10.1.1.2: bytes=56 Sequence=8 ttl=255 time=32 ms
--- 10.1.1.2 ping statistics ---
8 packet(s) transmitted
8 packet(s) received
0.00% packet loss
round-trip min/avg/max = 32/32/32 ms
<HUAWEI> ping -detail 10.1.1.3
PING 10.1.1.3: 56 data bytes, press CTRL_C to break
Request time out (unroutable)
Request time out (unroutable)
Request time out (unroutable)
Request time out (unroutable)
Request time out (unroutable)
--- 10.1.1.3 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
<HUAWEI> ping -range min 56 max 60 192.168.1.9
PING 192.168.1.9: 56-60 data bytes, press CTRL_C to break
Reply from 192.168.1.9: bytes=56 Sequence=1 ttl=255 time=80 ms
Reply from 192.168.1.9: bytes=57 Sequence=2 ttl=255 time=60 ms
Reply from 192.168.1.9: bytes=58 Sequence=3 ttl=255 time=80 ms
Reply from 192.168.1.9: bytes=59 Sequence=4 ttl=255 time=80 ms
Reply from 192.168.1.9: bytes=60 Sequence=5 ttl=255 time=50 ms
--- 192.168.1.9 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/70/80 ms
<HUAWEI> ping -m 3000 -s 300 -vpn-instance vpna 10.1.1.2
PING 10.1.1.2: 300 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=300 Sequence=1 ttl=255 time=31 ms
Reply from 10.1.1.2: bytes=300 Sequence=2 ttl=255 time=31 ms
Reply from 10.1.1.2: bytes=300 Sequence=3 ttl=255 time=31 ms
Reply from 10.1.1.2: bytes=300 Sequence=4 ttl=255 time=31 ms
Reply from 10.1.1.2: bytes=300 Sequence=5 ttl=255 time=31 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/31/31 ms
<HUAWEI> ping -v -m 300 -t 300 10.0.0.1
PING 10.0.0.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 10.0.0.1: bytes=56 Sequence=2 ttl=255 time=259 ms
Error: Sequence number = 1 is less than the correct = 3!
Request time out
Error: Trip time = 320 ms is longer than wait time = 300 ms!
Reply from 10.0.0.1: bytes=56 Sequence=4 ttl=255 time=280ms
Reply from 10.0.0.1: bytes=56 Sequence=5 ttl=255 time=256 ms
--- 10.0.0.1 ping statistics ---
5 packet(s) transmitted
3 packet(s) received
40.00% packet loss
round-trip min/avg/max = 256/265/280 ms
<HUAWEI> ping -c 2 -a 192.168.10.2 -name 192.168.10.2
PING 192.168.10.2 (www.huawei.com): 56 data bytes, press CTRL_C to break
Reply from 192.168.10.2: bytes=56 Sequence=1 ttl=255 time=18 ms
Reply from 192.168.10.2: bytes=56 Sequence=2 ttl=255 time=8 ms
--- 192.168.10.2 ping statistics ---
2 packet(s) transmitted
2 packet(s) received
0.00% packet loss
round-trip min/avg/max = 8/13/18 ms
<HUAWEI> ping 192.168.12.2 bypass -si GigabitEthernet 0/1/24 PING 192.168.12.2: 56 data bytes, press CTRL_C to break Reply from 192.168.12.2: bytes=56 Sequence=1 ttl=254 time=1 ms Reply from 192.168.12.2: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 192.168.12.2: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 192.168.12.2: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 192.168.12.2: bytes=356 Sequence=5 ttl=254 time=1 ms --- 192.168.12.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/1/1 ms
<HUAWEI> ping -brief 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
!!!!!
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
<HUAWEI> ping www.huawei.com
PING www.huawei.com (192.168.10.2): 56 data bytes, press CTRL_C to break
Reply from 192.168.10.2: bytes=56 Sequence=1 ttl=255 time=7 ms
Reply from 192.168.10.2: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 192.168.10.2: bytes=56 Sequence=3 ttl=255 time=7 ms
Reply from 192.168.10.2: bytes=56 Sequence=4 ttl=255 time=11 ms
Reply from 192.168.10.2: bytes=56 Sequence=5 ttl=255 time=11 ms
--- www.huawei.com ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 7/9/11 ms
Item | Description |
---|---|
PING x.x.x.x | IP address of the destination host. |
press CTRL_C to break | You can terminate the ongoing ping test by pressing Ctrl+C. |
Reply from x.x.x.x | Response from the destination host to each ICMP Echo Request message, including:
|
Request time out(xxxx) | Request times out. The timeout cause is displayed, which can be:
Other causes of packet loss are not displayed. |
x data bytes | Length of the sent ICMP Echo Request message. |
x.x.x.x ping statistics | Statistics collected after the ping test is performed on the destination host, including:
|