ping6

命令功能

ping6用于测试IPv6网络连接是否正常。

命令格式

ping6 [-c count] [-I interface / sourceAddress] destination

参数说明

表 1 参数说明

参数

参数说明

取值范围

-c count

执行的次数,不带本参数则默认为4次。

1~65535

-I interface

指定网卡执行IPv6 ping操作。

N/A

-I sourceAddress

指定源IPv6地址执行ping操作。

N/A

destination

目标主机地址。

N/A

使用指南

  • 如果目的IPv6地址不可达,会显示请求超时。
  • 如果显示发送错误,说明没有到目的IPV6的路由。
  • 命令需要启动TCP/IP协议栈后才能使用。

使用实例

  • ping6 2001:a:b:c:d:e:f:b
  • ping6 -c 3 2001:a:b:c:d:e:f:b
  • ping6 -I eth0 2001:a:b:c:d:e:f:b
  • ping6 -I 2001:a:b:c:d:e:f:d 2001:a:b:c:d:e:f:b

输出说明

  1. 输入ping6 2001:a:b:c:d:e:f:b

    1. OHOS # ping6 2001:a:b:c:d:e:f:b PING 2001:A:B:C:D:E:F:B with 56 bytes of data.
    2. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms
    3. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms
    4. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms
    5. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms
    6. --- 2001:a:b:c:d:e:f:b/64 ping statistics ---
    7. 4 packets transmitted, 4 received, 0.00% packet loss, time 20ms
    8. rtt min/avg/max = 0/0.00/0 ms
  2. 输入 ping6 -c 3 2001:a:b:c:d:e:f:b 指定3次进行网络测试

    1. 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.
    2. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms
    3. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms
    4. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms
    5. --- 2001:a:b:c:d:e:f:b/64 ping statistics ---
    6. 3 packets transmitted, 3 received, 0.00% packet loss, time 20ms
    7. rtt min/avg/max = 0/0.00/0 ms
  3. 输入 ping6 -I eth0 2001:a:b:c:d:e:f:b 使用指定网卡接口eth0测试IPv6。

    1. 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.
    2. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time=10 ms
    3. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms
    4. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms
    5. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms
    6. --- 2001:a:b:c:d:e:f:b/64 ping statistics ---
    7. 4 packets transmitted, 4 received, 0.00% packet loss, time 30msrtt min/avg/max = 0/2.50/10 ms
  4. 输入 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进行测试。

    1. 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.
    2. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=1 time<1 ms
    3. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=2 time<1 ms
    4. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=3 time<1 ms
    5. 56 bytes from 2001:A:B:C:D:E:F:B : icmp_seq=4 time<1 ms
    6. --- 2001:a:b:c:d:e:f:b/64 ping statistics ---
    7. 4 packets transmitted, 4 received, 0.00% packet loss, time 20msrtt min/avg/max = 0/0.00/0 ms