我在 nanoPI 上安装了 armbian,但 IPv6 自动配置无法按预期工作。网络上还有另一台计算机,它已配置 IPv6 隧道并安装了 radvd 来通告 IPv6 自动配置。它在我的笔记本电脑上运行良好,其中 IPv6 是自动配置的。
带有 armbian 的 nanoPi 用于 IPv4 wireguard 隧道、缓存 DNS 和 IPv4 DHCP。一切都运行良好,我不想搞砸它。但是,我也希望它能与 IPv6 配合使用。我在日志中发现,DNS 尝试建立 IPv6 连接并报告“网络不可达”。
net.ipv6.conf.*.accept_ra
我认为问题出在默认 IPv6 网关上。我首先认为它与内核选项和有关net.ipv6.conf.*.forwarding
。然后我停止调整这些选项,但仍然得到这些奇怪的结果。以下命令显示发生了什么:
root@hostname:/home/nobody# systemctl restart networking; sleep 5; ip -6 route; echo --------------; sleep 30; ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2001:470:dead:beef::/64 dev eth0 proto kernel metric 256 expires 86398sec pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
default via fe80::e578:dc2a:5850:1a23 dev eth0 proto ra metric 1024 expires 1798sec hoplimit 64 pref medium
-------------
::1 dev lo proto kernel metric 256 pref medium
2001:470:dead:beef::/64 dev eth0 proto kernel metric 256 expires 86368sec pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
从输出中可以看出,有一个默认网关,然后它就消失了。我不知道是什么在网络重启后不久删除了网关。可以观察到,重启后 5 秒有一个默认网关,但重启后 30 秒就不再存在了。
我应该如何设置正确的 IPv6 选项,以便 eth0 正确设置并保持 IPv6 路由。已分配 IPv6 地址。在 中/etc/network/interfaces
,eth0 的 IPv6 非常简单:
iface eth0 inet6 auto
网络地址为eth0
:
root@hostname:/home/nobody# /sbin/ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.3 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 2001:470:dead:beef:9839:10ff:fe2c:bc8b prefixlen 64 scopeid 0x0<global>
inet6 fe80::9839:10ff:fe2c:bc8b prefixlen 64 scopeid 0x20<link>
ether 9a:39:10:2c:bc:8b txqueuelen 1000 (Ethernet)
RX packets 99643 bytes 19933415 (19.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 70276 bytes 15165013 (15.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 36
这些是回答评论中的问题的附加信息。
在中/etc/sysctl.conf
,我只有一行与之相关net.ipv6.conf
:
net.ipv6.conf.all.forwarding=1
我也尝试禁用转发。结果是一样的。
radvd
/etc/radvd.conf
网关上的设置是:
interface eth0
{
AdvSendAdvert on;
AdvLinkMTU 1480;
prefix 2001:470:dead:beef::/64
{
AdvOnLink on;
AdvAutonomous on;
};
};
rdisc6 eth0
nanoPI armbian 上显示:
nobody@hostname:~$ rdisc6 eth0
Soliciting ff02::2 (ff02::2) on eth0...
Hop limit : 64 ( 0x40)
Stateful address conf. : No
Stateful other conf. : No
Mobile home agent : No
Router preference : medium
Neighbor discovery proxy : No
Router lifetime : 1800 (0x00000708) seconds
Reachable time : unspecified (0x00000000)
Retransmit time : unspecified (0x00000000)
Prefix : 2001:470:dead:beef::/64
On-link : Yes
Autonomous address conf.: Yes
Valid time : 86400 (0x00015180) seconds
Pref. time : 14400 (0x00003840) seconds
Source link-layer address: 02:BA:01:E2:BB:0A
from fe80::e578:dc2a:5850:1a23
网关上的网络配置为:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.4 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 2001:470:dead:beaf:ba:1ff:fee2:bb0a prefixlen 64 scopeid 0x0<global>
inet6 fe80::e578:dc2a:5850:1a23 prefixlen 64 scopeid 0x20<link>
inet6 2001:470:dead:beef:d80:ee60:c02c:fd7b prefixlen 64 scopeid 0x0<global>
inet6 2001:470:dead:beef:d335:85e2:7581:a8bb prefixlen 64 scopeid 0x0<global>
inet6 2001:470:dead:beef:a4cd:3f7c:831e:5741 prefixlen 64 scopeid 0x0<global>
inet6 2001:470:dead:beef:4de7:a7f9:b4f1:276f prefixlen 64 scopeid 0x0<global>
inet6 2001:470:dead:beef:579c:d1ec:a9e4:956e prefixlen 64 scopeid 0x0<global>
ether 02:ba:01:e2:bb:0a txqueuelen 1000 (Ethernet)
RX packets 1878860 bytes 2020311395 (2.0 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1706952 bytes 1964158895 (1.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 42
he-ipv6: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480
inet6 2001:470:deaf:beef::2 prefixlen 64 scopeid 0x0<global>
inet6 fe80::c0a8:4 prefixlen 64 scopeid 0x20<link>
sit txqueuelen 1000 (IPv6-in-IPv4)
RX packets 1419735 bytes 1890050581 (1.8 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 258256 bytes 40728885 (40.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0