如何在单接口添加多个IPv6地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 编辑网卡文件
nano /etc/network/interfaces

# 添加如下
iface eth0 inet6 static
address 2605:6400:20:26ac:3811:b9e9:89c6:d35c
netmask 48
gateway 2605:6400:20::1
# Add additional IPv6 addresses when $IFACE goes up
up ip -6 addr add 2605:6400:20:26ac:c128:f58d:caee:cb6e/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:3eef:bd11:a3f9:3ff6/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:767b:3444:153b:d3a1/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:4d1c:df41:f721:33e8/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:6117:def2:5d31:f117/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:a915:1dd9:58e2:b3e2/48 dev $IFACE
up ip -6 addr add 2605:6400:20:26ac:84db:81e9:5132:3d1d/48 dev $IFACE
# Remove them when $IFACE goes down
down ip -6 addr del 2605:6400:20:26ac:84db:81e9:5132:3d1d/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:c128:f58d:caee:cb6e/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:3eef:bd11:a3f9:3ff6/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:767b:3444:153b:d3a1/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:4d1c:df41:f721:33e8/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:6117:def2:5d31:f117/48 dev $IFACE
down ip -6 addr del 2605:6400:20:26ac:a915:1dd9:58e2:b3e2/48 dev $IFACE