第一步,通过命令 ip addr 列出网络接口的名称
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:5e:00:53:3a brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:5e:00:53:3b brd ff:ff:ff:ff:ff:ff
第二步:配置上面我们看到的eth0这个接口为ipv6地址:
vi /etc/network/interfaces ,添加:
iface eth0 inet6 static
address 2001:db8:100:15a::1
netmask 64
dns-nameservers 2001:41d0:3:163::1
post-up sleep 5; /sbin/ip -family inet6 route add 2001:db8:100:1ff:ff:ff:ff:ff dev eth0
post-up sleep 5; /sbin/ip -family inet6 route add default via 2001:db8:100:1ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del default via 2001:db8:100:1ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del 2001:db8:100:1ff:ff:ff:ff:ff dev eth0
第三步:启用网络接口eth0,并且重启网络服务。
ip link set eth0 up
systemctl restart networking
这样基本可以出去了,ping一个ipv6 的地址:
ping6 2606:2800:220:1:248:1893:25c8:1946
IPv6网址建好后,如果自己本机是IPv4的网络,想要测试纯IPv6网址的内容,可以通过 https://ipv6proxy.cn 来进行测试。