Debian up in /etc/network/interfaces not working

debianifconfigipv6linux-networking

I'm trying to add a secondary IPv6 address to eth0 on Debian Sid.

I added the following lines to /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

After a reboot there is only one IPv6 address assigned to eth0. However, if I simply execute the command (/sbin/ifconfig eth0 inet6 add [IPv6 address #2]/64) manually, I have 2 IPv6 addresses assigned to eth0, just like I want.

It looks like the up command is just not executed at all. Has this been changed? I do have a /etc/network/if-up.d directory, but I read that those scripts may be run more than once.

How can I make up work or add a second IPv6 address on Debian Sid?

Best Answer

Not a direct answer to why up doesn't work, but maybe a solution for your problem:

I usually use the same configuration style for multiple IPv4 and IPv6 addresses for consistency. This is the configuration of one of my servers:

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

The IPv6 addresses show up on eth0 not on eth0:0 and eth0:1 when seen through ifconfig:

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

I don't know why your configuration doesn't work, but maybe doing it this way will work for you...