• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ping
2
3
4## Command Function
5
6This command is used to test an IPv4 connection.
7
8
9## Syntax
10
11ping *[-4] [-c cnt] [-f] [-i interval] [-q] [-s size] <IP>*
12
13
14## Parameters
15
16**Table 1** Parameter description
17
18| Parameter| Description| Value Range|
19| -------- | -------- | -------- |
20| --help | Displays the parameters supported by the **ping** command.| N/A |
21| -4 | Forcibly pings the destination address using the IPv4 protocol.| 0-65500 |
22| -c CNT | Specifies the number of execution times. The default value is **3**.| 1-65535 |
23| -f | Pings an IPv4 address in implicit mode. The default parameter configuration is equivalent to **-c 15 -i 0.2**.| N/A |
24| -i interval | Specifies the interval (in ms) for sending a ping packet.| 1-200 |
25| -q | Implicitly pings an IPv4 address. If the host is still alive, the ping stops after **true** is returned.| N/A |
26| -s SIZE | Specifies the size of a ping packet, in bytes. The default size is **56** bytes.| 0-4088 |
27| IP | Specifies the IPv4 address of the network to test.| N/A |
28
29
30## Usage Guidelines
31
32- The **ping** command is used to check whether the destination IP address is reachable.
33
34- If the destination IP address is unreachable, the system displays a message indicating that the request times out.
35
36- If no route is available to the destination IP address, an error message is displayed.
37
38- This command can be used only after the TCP/IP protocol stack is enabled.
39
40
41## Example
42
43Run **ping 192.168.1.3**.
44
45
46## Output
47
48Ping a TFTP server IP address.
49
50```
51OHOS:/$ ping 192.168.1.3
52Ping 192.168.1.3 (192.168.1.3): 56(84) bytes.
5384 bytes from 192.168.1.3: icmp_seq=0 ttl=0 time=0 ms
5484 bytes from 192.168.1.3: icmp_seq=0 ttl=0 time=1 ms
5584 bytes from 192.168.1.3: icmp_seq=0 ttl=0 time=0 ms
56--- 192.168.1.3 ping statistics ---
573 packets transmitted, 3 received, 0% packet loss
58round-trip min/avg/max = 0/0/0 ms
59```
60