在RackNerd DC02 VPS上配置IPv6地址
本文转载自:RackNerd服务器IPv6配置教程。
近期,RackNerd DC02区域的VPS可以支持申请100个IPv6地址了,但是申请后如果不重装系统的话,是无法自动配置IPv6地址的,所以转载一下这篇文章中手动配置IPv6地址的方法。
步骤如下:
打开
/etc/sysctl.conf
文件,在文件的最后一行增加:1
2
3
4net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.eth0.accept_ra = 0注释禁用IPv6的配置(如果存在):
1
2
3net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1修改为:
1
2
3# net.ipv6.conf.all.disable_ipv6 = 1
# net.ipv6.conf.default.disable_ipv6 = 1
# net.ipv6.conf.lo.disable_ipv6 = 1保存文件后执行以下命令以应用配置:
1
sysctl -p
执行以下命令重启网络:
1
systemctl restart networking
如果出现以下错误:
1
2Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xeu networking.service" for details.请尝试打开
/etc/network/interfaces
,删除:1
up ip -6 route add 2607:0000:0000:0000:0000:0000:0000:0001 dev eth0
再次尝试执行:
1
systemctl restart networking
最后测试IPv6是否正常:
1
curl ip.me -6
如果返回的是本机的IPv6地址,则配置成功。