我正在尝试在Debian Sid上为eth0添加一个辅助IPv6地址。
我在/etc/network/interfaces添加了以下几行:
iface eth0 inet6 static address [IPv6 address #1] netmask 64 gateway [IPv6 gateway] pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/autoconf up /sbin/ifconfig eth0 inet6 add [IPv6 address #2]/64
重启后,只有一个IPv6地址分配给eth0 。 但是,如果我手动执行命令( /sbin/ifconfig eth0 inet6 add [IPv6 address #2]/64 ),我有两个IPv6地址分配给eth0 ,就像我想要的。
看起来up命令根本就没有执行。 这个改变了吗? 我有一个/etc/network/if-up.d目录,但是我读了这些脚本可能会运行多次。
如何在Debian Sid上补充工作或添加第二个IPv6地址?
不直接回答为什么up不起作用,但也许是你的问题的解决scheme:
我通常使用相同的configuration样式来保持多个IPv4和IPv6地址的一致性。 这是我的一个服务器的configuration:
auto eth0 iface eth0 inet static address 94.142.242.211 netmask 28 gateway 94.142.242.209 iface eth0 inet6 static address 2a02:898:148::211 netmask 64 gateway 2a02:898:148::1 auto eth0:0 iface eth0:0 inet static address 94.142.242.212 netmask 28 iface eth0:0 inet6 static address 2a02:898:148::212 netmask 64 auto eth0:1 iface eth0:1 inet static address 94.142.242.217 netmask 28 iface eth0:1 inet6 static address 2a02:898:148::217 netmask 64
当通过ifconfig查看时,IPv6地址显示在eth0而不显示在eth0:0和eth0:1 :
eth0 Link encap:Ethernet HWaddr 00:50:56:80:96:82 inet addr:94.142.242.211 Bcast:94.142.242.223 Mask:255.255.255.240 inet6 addr: 2a02:898:148::217/64 Scope:Global inet6 addr: 2a02:898:148::212/64 Scope:Global inet6 addr: 2a02:898:148::211/64 Scope:Global inet6 addr: fe80::250:56ff:fe80:9682/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:0 Link encap:Ethernet HWaddr 00:50:56:80:96:82 inet addr:94.142.242.212 Bcast:94.142.242.223 Mask:255.255.255.240 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:1 Link encap:Ethernet HWaddr 00:50:56:80:96:82 inet addr:94.142.242.217 Bcast:94.142.242.223 Mask:255.255.255.240 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
我不知道为什么你的configuration不起作用,但也许这样做会为你工作…