1

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?

  • Try putting a `touch` command in the file instead of the `ifconfig` command, that way you can verify if the command gets executed at all. Also verify if it makes a difference whether DAD is enabled or disabled. – kasperd Sep 13 '14 at 14:13
  • Thanks, I changed it to `up touch /root/ipv6test` but the file doesn't exist after a reboot. – Louis Matthijssen Sep 13 '14 at 14:32
  • Does `up` work if you put in an `inet` stanza rather than an `inet6` stanza? – kasperd Sep 13 '14 at 14:41
  • According to the documentation I am looking at `up` and `post-up` are synonyms. May still be worth testing if using one or the other makes a difference. – kasperd Sep 13 '14 at 14:45

1 Answers1

1

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...

Sander Steffann
  • 7,712
  • 19
  • 29
  • Thanks, it seems to work but then I can't ping anything. Example (ping6 google.com): `11 packets transmitted, 0 received, 100% packet loss, time 10080ms`. Removing the lines makes it work again. – Louis Matthijssen Sep 13 '14 at 14:24
  • The Linux kernel usually chooses the last added IPv6 address as its default source address. For IPv4 it will use the address on `eth0` and not those on `eth0:*`. So in the config above it would probably use `94.142.242.211` and `2a02:898:148::217` by default. Maybe your firewall settings need to be adjusted for that. – Sander Steffann Sep 13 '14 at 14:27
  • PS: The default source address can be overridden manually by executing i.e. `/sbin/ip -6 route add default via 2a02:898:148::1 src 2a02:898:148::211 metric 1`. – Sander Steffann Sep 13 '14 at 14:31
  • If I add the address manually I can ping using both IP addresses (`ping6 -I [IPv6 address #1] google.com` and `ping6 -I [IPv6 address #2] google.com` both work). So I guess it's not a firewall issue? I've never had this problem before. – Louis Matthijssen Sep 13 '14 at 14:36
  • That is weird indeed... No idea how that can happen. Can you show the output of `ip -6 addr` and `ip -6 route` after adding the lines in `/etc/network/interfaces`? – Sander Steffann Sep 13 '14 at 14:37
  • Okay I just saw that IPv6 sometimes just stops working. This answer is working for me! I'll contact my ISP about the weird IPv6 availability. – Louis Matthijssen Sep 13 '14 at 14:49
  • Feel free to contact me off-list to tell me which ISP it is, I know many of them so maybe I can help :) – Sander Steffann Sep 13 '14 at 14:51