我正在使用提供商提供的静态IPv4和IPv6地址在KVM服务器上配置双堆栈网络。
在安装Ubuntu时,我根据需要输入了所有地址,名称服务器和网关。在那之后,我检查了/etc/network/interfaces
文件,发现没有IPv6节(ifconfig
执行确认了这一点),因此我添加了相关行。这是最终文件:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 151.236.18.86
netmask 255.255.255.0
network 151.236.18.0
broadcast 151.236.18.255
gateway 151.236.18.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 91.227.204.227 91.227.205.227
dns-search mydomainname.com
iface eth0 inet6 static
pre-up modprobe ipv6
address 2001:b60:1000:151:236:18:86:0
netmask 112
gateway 2001:b60:1000::1
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
dns-search mydomainname.com
然后,我通过重新启动网络,sudo /etc/init.d/networking stop && sudo /etc/init.d/networking restart
并注意到在IPv4正常运行时,出站IPv6连接不可用(我尚未检查入站连接)。
ifconfig
并ip -6 addr
显示可识别的IPv6地址:
eth0 Link encap:Ethernet HWaddr 52:54:00:b1:27:87
inet addr:151.236.18.86 Bcast:151.236.18.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:feb1:2787/64 Scope:Link
inet6 addr: 2001:b60:1000:151:236:18:86:0/112 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16409 errors:0 dropped:0 overruns:0 frame:0
TX packets:1178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1126656 (1.1 MB) TX bytes:763658 (763.6 KB)
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:b60:1000:151:236:18:86:0/112 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:feb1:2787/64 scope link
valid_lft forever preferred_lft forever
相反,IPv6堆栈不存在默认路由:
$ ip -6 route
2001:b60:1000:151:236:18:86:0/112 dev eth0 proto kernel metric 256
fe80::/64 dev eth0 proto kernel metric 256
尝试添加缺少的路由会导致“没有路由到主机”错误:
$ sudo ip -6 route add default via 2001:b60:1000::1
RTNETLINK answers: No route to host
可能出什么问题了,我该如何修复网络配置以使IPv6堆栈正常工作?
ping6 -c 3 ipv6.google.com
,DNS找到了该地址,但是有100%的数据包丢失)。有任何想法吗?