一、编辑网卡文件

apt install vim
vim /etc/network/interfaces

二、添加IPv6地址

iface eth0 inet6 static
address 你的公用IPV6地址
netmask 64
gateway 你的IPV6网关
autoconf 0
dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888

三、重启网络或者重启服务器

重启网络

/etc/init.d/networking restart

重启服务器

reboot

四、测试

ping6 google.com

五、其他

查看IPv6网关

ip -6 route show dev YOURDEVICE

获取本机IPv6信息

cat /proc/net/if_inet6

net.ipv6.conf.all.autoconf = 1
net.ipv6.conf.all.accept_ra = 1
net.ipv6.conf.eth0.autoconf = 1
net.ipv6.conf.eth0.accept_ra = 1

或者直接修改文件也可以的!/etc/sysctl.conf  把上面的改为

net.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

保存重启服务器 笨人笨方法

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注