帮助在 Deban 9 上设置 IPv6 我的 IPv6 配置不起作用:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens3
iface ens3 inet static
address 217.182.53.46/24
gateway 217.182.53.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8 77.88.8.8
dns-search 8.8.8.8
iface ens3 inet6 static
address 2001:41d0:2:fa3e::2/64
netmask 64
gateway 2001:41d0:2:faff:ff:ff:ff:ff
怎么解决?
IPv6:2001:41d0:2:fa3e::2/64
GW:2001:41d0:2:faff:ff:ff:ff:ff
答案1
您的配置有错误。您的网关不在您的子网范围内。
子网范围2001:41d0:2:fa3e::/64
是2001:41d0:0002:fa3e:0000:0000:0000:0000
- 2001:41d0:0002:fa3e:ffff:ffff:ffff:ffff
。但是,2001:41d0:2:faff:ff:ff:ff:ff
超出了该范围。
工作配置的示例:
iface eth0 inet6 static
address 2001:db8:7927::61
netmask 64
gateway 2001:db8:7927::1
另一个问题可能是您在 上配置了 IPv4 地址,ens3
而在 上配置了 IPv6 地址eth0
。这可能是故意的,但很容易被忽略。
答案2
这OVH IPv6 帮助文档解释说您需要为 IPv6 网关添加静态路由,因为它位于分配给您的服务器的 IPv6 子网之外。
因此,您的接口文件应包含相关部分:
iface ens3 inet6 static
address 2001:41d0:2:fa3e::2
netmask 128
post-up /sbin/ip -f inet6 route add 2001:41d0:2:faff:ff:ff:ff:ff dev ens3
post-up /sbin/ip -f inet6 route add default via 2001:41d0:2:faff:ff:ff:ff:ff
pre-down /sbin/ip -f inet6 route del 2001:41d0:2:faff:ff:ff:ff:ff dev ens3
pre-down /sbin/ip -f inet6 route del default via 2001:41d0:2:faff:ff:ff:ff:ff