1# ping6<a name="ZH-CN_TOPIC_0000001134006274"></a> 2 3- [命令功能](#section1057291313393) 4- [命令格式](#section199901315123919) 5- [参数说明](#section4679319113919) 6- [使用指南](#section1127917226399) 7- [使用实例](#section7211192553917) 8- [输出说明](#section4846145221215) 9 10## 命令功能<a name="section1057291313393"></a> 11 12ping6用于测试IPv6网络连接是否正常。 13 14## 命令格式<a name="section199901315123919"></a> 15 16ping6 _\[-c count\] \[-I interface / sourceAddress\] destination_ 17 18## 参数说明<a name="section4679319113919"></a> 19 20**表 1** 参数说明 21 22<a name="table2742mcpsimp"></a> 23<table><thead align="left"><tr id="row2748mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p2750mcpsimp"><a name="p2750mcpsimp"></a><a name="p2750mcpsimp"></a>参数</p> 24</th> 25<th class="cellrowborder" valign="top" width="52%" id="mcps1.2.4.1.2"><p id="p2752mcpsimp"><a name="p2752mcpsimp"></a><a name="p2752mcpsimp"></a>参数说明</p> 26</th> 27<th class="cellrowborder" valign="top" width="27%" id="mcps1.2.4.1.3"><p id="p2754mcpsimp"><a name="p2754mcpsimp"></a><a name="p2754mcpsimp"></a>取值范围</p> 28</th> 29</tr> 30</thead> 31<tbody><tr id="row2755mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p2757mcpsimp"><a name="p2757mcpsimp"></a><a name="p2757mcpsimp"></a>-c count</p> 32</td> 33<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p2759mcpsimp"><a name="p2759mcpsimp"></a><a name="p2759mcpsimp"></a>执行的次数,不带本参数则默认为4次。</p> 34</td> 35<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p2761mcpsimp"><a name="p2761mcpsimp"></a><a name="p2761mcpsimp"></a>1~65535</p> 36</td> 37</tr> 38<tr id="row2762mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p2764mcpsimp"><a name="p2764mcpsimp"></a><a name="p2764mcpsimp"></a>-I interface</p> 39</td> 40<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p2766mcpsimp"><a name="p2766mcpsimp"></a><a name="p2766mcpsimp"></a>指定网卡执行IPv6 ping操作。</p> 41</td> 42<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p2768mcpsimp"><a name="p2768mcpsimp"></a><a name="p2768mcpsimp"></a>N/A</p> 43</td> 44</tr> 45<tr id="row2769mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p2771mcpsimp"><a name="p2771mcpsimp"></a><a name="p2771mcpsimp"></a>-I sourceAddress</p> 46</td> 47<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p2773mcpsimp"><a name="p2773mcpsimp"></a><a name="p2773mcpsimp"></a>指定源IPv6地址执行ping操作。</p> 48</td> 49<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p2775mcpsimp"><a name="p2775mcpsimp"></a><a name="p2775mcpsimp"></a>N/A</p> 50</td> 51</tr> 52<tr id="row84173618410"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p141163619410"><a name="p141163619410"></a><a name="p141163619410"></a>destination</p> 53</td> 54<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p134111362417"><a name="p134111362417"></a><a name="p134111362417"></a>目标主机地址。</p> 55</td> 56<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p134173611412"><a name="p134173611412"></a><a name="p134173611412"></a>N/A</p> 57</td> 58</tr> 59</tbody> 60</table> 61 62## 使用指南<a name="section1127917226399"></a> 63 64- 如果目的IPv6地址不可达,会显示请求超时。 65- 如果显示发送错误,说明没有到目的IPV6的路由。 66- 命令需要启动TCP/IP协议栈后才能使用。 67 68## 使用实例<a name="section7211192553917"></a> 69 70- ping6 2001:a:b:c:d:e:f:b 71- ping6 -c 3 2001:a:b:c:d:e:f:b 72- ping6 -I eth0 2001:a:b:c:d:e:f:b 73- ping6 -I 2001:a:b:c:d:e:f:d 2001:a:b:c:d:e:f:b 74 75## 输出说明<a name="section4846145221215"></a> 76 771. 输入ping6 2001:a:b:c:d:e:f:b 78 79 ``` 80 OHOS # ping6 2001:a:b:c:d:e:f:b PING 2001:A:B:C:D:E:F:B with 56 bytes of data. 81 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms 82 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms 83 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms 84 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms 85 --- 2001:a:b:c:d:e:f:b/64 ping statistics --- 86 4 packets transmitted, 4 received, 0.00% packet loss, time 20ms 87 rtt min/avg/max = 0/0.00/0 ms 88 ``` 89 902. 输入 ping6 -c 3 2001:a:b:c:d:e:f:b 指定3次进行网络测试 91 92 ``` 93 OHOS # ping6 -c 3 2001:a:b:c:d:e:f:b PING 2001:A:B:C:D:E:F:B with 56 bytes of data. 94 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms 95 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms 96 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms 97 --- 2001:a:b:c:d:e:f:b/64 ping statistics --- 98 3 packets transmitted, 3 received, 0.00% packet loss, time 20ms 99 rtt min/avg/max = 0/0.00/0 ms 100 ``` 101 1023. 输入 ping6 -I eth0 2001:a:b:c:d:e:f:b 使用指定网卡接口eth0测试IPv6。 103 104 ``` 105 OHOS # ping6 -I eth0 2001:a:b:c:d:e:f:b PING 2001:A:B:C:D:E:F:B with 56 bytes of data. 106 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time=10 ms 107 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms 108 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms 109 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms 110 --- 2001:a:b:c:d:e:f:b/64 ping statistics --- 111 4 packets transmitted, 4 received, 0.00% packet loss, time 30msrtt min/avg/max = 0/2.50/10 ms 112 ``` 113 1144. 输入 ping6 -I 2001:a:b:c:d:e:f:d 2001:a:b:c:d:e:f:b 使用指定的源IPv6地址2001:a:b:c:d:e:f:d进行测试。 115 116 ``` 117 OHOS # ping6 -I 2001:a:b:c:d:e:f:d 2001:a:b:c:d:e:f:b PING 2001:A:B:C:D:E:F:B with 56 bytes of data. 118 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms 119 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms 120 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms 121 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms 122 --- 2001:a:b:c:d:e:f:b/64 ping statistics --- 123 4 packets transmitted, 4 received, 0.00% packet loss, time 20msrtt min/avg/max = 0/0.00/0 ms 124 ``` 125 126 127