编辑:
vim /etc/network/interfaces
在文件末尾添加内容:
格式:
iface eth0 inet6 static
address 分配的IPv6地址(必须完整地址)
netmask 查询到的位掩码(一般是48)
gateway 查询到的IPv6网关地址
举例:
iface eth0 inet6 static
address 2605:6400:0020:1b99:0000:0000:0000:0001
netmask 48
gateway 2605:6400:0020:0000:0000:0000:0000:0001
最后保存,重启
① 或者使用命令自动获取IPv6,但是每次重启都需要运行该命令
(网卡名称默认为ens3)
dhclient -6 ens3
②查看IPv6是否生效
ip add
测试IPv6地址:
ping6 google.com