linux系统下ping ipv6
程序员文章站
2022-07-12 12:56:10
...
前言
ipv6正在逐渐的普及,内网设备支持ipv6协议,其相关的设备也会相应的ipv6地址
同一台交换机下互ping其ipv6地址
查看a服务器的网卡信息
[[email protected] ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:96:01:0c brd ff:ff:ff:ff:ff:ff
inet 10.0.0.195/24 brd 10.0.0.255 scope global noprefixroute ens160
valid_lft forever preferred_lft forever
inet6 fe80::7766:f748:7013:c7e5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:c7:0b:11:03 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:c7ff:fe0b:1103/64 scope link
valid_lft forever preferred_lft forever
13: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether ae:43:be:45:df:d0 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::ac43:beff:fe45:dfd0/64 scope link
valid_lft forever preferred_lft forever
b服务器ping另一台即a服务器的ipv6网卡
-
语法:
ping6 -I 网卡 ipv6地址 -
示例:
[[email protected] ~]# ping6 -c 3 -I ens160 fe80::9480:9394:ee87:646d
PING fe80::9480:9394:ee87:646d(fe80::9480:9394:ee87:646d) from fe80::250:56ff:fe96:4171%ens160 ens160: 56 data bytes
64 bytes from fe80::9480:9394:ee87:646d%ens160: icmp_seq=1 ttl=64 time=0.692 ms
64 bytes from fe80::9480:9394:ee87:646d%ens160: icmp_seq=2 ttl=64 time=0.271 ms
64 bytes from fe80::9480:9394:ee87:646d%ens160: icmp_seq=3 ttl=64 time=0.332 ms
--- fe80::9480:9394:ee87:646d ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.271/0.431/0.692/0.187 ms
```
#### 补充
fe80为内网的ipv6地址
#### 结语
[局域网内使用ipv6 通信](https://www.cnblogs.com/lfxiao/p/10102294.html)