我对 IPv6 世界还很陌生。
我正在尝试fc00::a6:32:67:c9:23
从同一网络上的另一台主机对地址执行 ping 操作,但到目前为止还不起作用(尽管我能够使用链路本地单播地址对设备执行 ping 操作)。
我的本地主机上的网络配置(ping 的来源)如下所示:
host1$ ip addr
2: wlp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 10:4a:7d:cd:e6:73 brd ff:ff:ff:ff:ff:ff
inet 192.168.55.61/24 brd 192.168.55.255 scope global dynamic noprefixroute wlp6s0
valid_lft 348sec preferred_lft 348sec
inet6 fe80::68b0:2809:2bab:2e8b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
5: enx000ec6a6aea4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0e:c6:a6:ae:a4 brd ff:ff:ff:ff:ff:ff
inet 192.168.55.198/24 metric 1024 brd 192.168.55.255 scope global dynamic enx000ec6a6aea4
valid_lft 599sec preferred_lft 599sec
inet6 fc00::e:c6a6:aea4/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::2576:c20e:e91d:7677/64 scope link noprefixroute
valid_lft forever preferred_lft forever
本地路由表如下所示:
$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2001:db8:100:1ff:ff:ff:ff:ff dev enx000ec6a6aea4 proto static metric 1024 pref medium
fc00::/64 dev enx000ec6a6aea4 proto kernel metric 256 pref medium
fe80::/64 dev wlp6s0 proto kernel metric 1024 pref medium
fe80::/64 dev enx000ec6a6aea4 proto kernel metric 1024 pref medium
default via 2001:db8:100:1ff:ff:ff:ff:ff dev enx000ec6a6aea4 proto static metric 1024 pref medium
目标主机上的界面如下所示:
host2$ ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:67:c9:23 brd ff:ff:ff:ff:ff:ff
inet 192.168.55.187/24 brd 192.168.55.255 scope global dynamic noprefixroute eth0
valid_lft 599sec preferred_lft 524sec
inet6 fc00::a6:32:67:c9:23/64 scope global tentative noprefixroute
valid_lft forever preferred_lft forever
inet6 2001::a6:32:67:c9:23/64 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::a790:54e2:224b:f14/64 scope link
valid_lft forever preferred_lft forever
我想知道为什么目标主机上tentative
我的前缀 IP 地址旁边有一个?fc00
有谁知道吗?这是我 ping 问题的原因吗?
答案1
虽然您的源主机具有:
inet6 fc00::e:c6a6:aea4/64 scope global
的输出ip -6 route
显示没有到相应网络的路由,也没有显示默认的 ipv6 路由。您的源主机不知道如何到达目标地址。
如果我在本地系统上分配该地址,它会自动生成适当的路由:
host1$ ip addr add fc00::e:c6a6:aea4/64 dev eth0
host1$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
fc00::/64 dev eth0 proto kernel metric 256 pref medium # <-- this one here
fe80::/64 dev eth0 proto kernel metric 1024 pref medium
但还有第二个问题:地址fc00::e:c6a6:aea4/64
在网络上fc00::/64
。但是,您的目标地址fc00::a6:32:67:c9:23/64
位于网络 上fc00:0:0:a6::/64
。这意味着即使您在 上有自动生成的路线host1
,它仍然无法到达您在 上的目标地址host2
。
为了让它在我的测试设置中工作,我需要在两个系统上添加路由。
- 在 上
host1
,我需要添加一条路线fc00:0:0:a6::/64
:
host1$ ip route add fc00:0:0:a6::/64 dev eth0
- 在 上
host2
,我需要添加一条路线fc00::/64
:
host2$ ip route add fc00::/64 dev wlan0
完成这些更改后,我可以fc00::a6:32:67:c9:23
从以下位置成功执行 ping 操作fc00::e:c6a6:aea4
:
[root@host1 ~]# ip -6 addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
altname eno2
altname enp0s31f6
inet6 fc00::e:c6a6:aea4/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::ed9c:756f:92a:ef21/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@host1 ~]# ip -6 route | grep -v fe80
::1 dev lo proto kernel metric 256 pref medium
fc00::/64 dev eth0 proto kernel metric 256 pref medium
fc00:0:0:a6::/64 dev eth0 metric 1024 pref medium
[root@host1 ~]# ping -c2 fc00::a6:32:67:c9:23
PING fc00::a6:32:67:c9:23(fc00::a6:32:67:c9:23) 56 data bytes
64 bytes from fc00::a6:32:67:c9:23: icmp_seq=1 ttl=64 time=107 ms
64 bytes from fc00::a6:32:67:c9:23: icmp_seq=2 ttl=64 time=15.3 ms
--- fc00::a6:32:67:c9:23 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 15.287/61.178/107.070/45.891 ms