4

On Hetzner Cloud with Debian and Ubuntu, I noticed that the default IPv6 has a preferred_lft of 0 second. It is thus "deprecated" and that leads to issues when adding another inet6, because non-deprecated ipv6 are prioritised.

root@debian-2gb-nbg1-1:~# ip -6 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2a01:4f8:c2c:6daa::1/64 scope global deprecated
       valid_lft forever preferred_lft 0sec
    inet6 fe80::9400:ff:fe2d:6848/64 scope link
       valid_lft forever preferred_lft forever

Here is the config:

root@debian-2gb-nbg1-1:~# cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
    dns-nameservers 213.133.99.99 213.133.98.98 213.133.100.100

auto eth0:0
iface eth0:0 inet6 static
    address 2a01:4f8:c2c:6daa::1/64
    gateway fe80::1
    post-up route add -net :: netmask 0 gw fe80::1%eth0 || true
    pre-down route del -net :: netmask 0 gw fe80::1%eth0 || true

Where does this 0sec comes from?

3
  • 1
    You have mistyped eth0:0, which should be eth0. Fix that first, and see if you still have a problem. Aug 9, 2019 at 19:47
  • I didn't modify anything, this is how Hetzner provides the VM. But it did indeed fix the issue, thanks
    – stan
    Aug 9, 2019 at 21:48
  • Hetzner should fix that, then. It has not been appropriate for many years. Aug 9, 2019 at 22:33

1 Answer 1

1

The solution is to not use a virtual interface for IPv6:

root@debian-2gb-nbg1-1:~# cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
    dns-nameservers 213.133.99.99 213.133.98.98 213.133.100.100
iface eth0 inet6 static
    address 2a01:4f8:c2c:6daa::1/64
    gateway fe80::1
    post-up route add -net :: netmask 0 gw fe80::1%eth0 || true
    pre-down route del -net :: netmask 0 gw fe80::1%eth0 || true

Then there will be no preferred_lft issue and the IPv6 won't be marked as deprecated.

root@debian-2gb-nbg1-1:~# ip -6 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2a01:4f8:c2c:6daa::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::9400:ff:fe2d:6848/64 scope link
       valid_lft forever preferred_lft forever

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .