vim /etc/network/interfaces
iface eth0 inet6 static
address 2001:db8:1:2::2
netmask 64
# Add additional IPv6 addresses when $IFACE goes up
up ip -6 addr add 2001:db8:1:2::3/64 dev $IFACE
up ip -6 addr add 2001:db8:1:2::4/64 dev $IFACE
# Remove them when $IFACE goes down
down ip -6 addr del 2001:db8:1:2::3/64 dev $IFACE
down ip -6 addr del 2001:db8:1:2::4/64 dev $IFACE
刷新网络配置:ifup ens3
重启生效:reboot
我的IP配置:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet dhcp
iface ens3 inet6 auto
iface ens3 inet6 static
address 2001:ffff:ffff:ffff:ffff:ffff:feb1:a59a
netmask 64
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb2:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb3:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb4:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb5:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb6:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb7:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb8:a59a
up /sbin/ip -6 addr add dev ens3 2001:ffff:ffff:ffff:ffff:ffff:feb9:a59a