Flatcar icon indicating copy to clipboard operation
Flatcar copied to clipboard

IPv6 not configured on Hetzner cloud

Open x4e-jonas opened this issue 2 weeks ago • 5 comments

Description

IPv6 is not assigned to the interface on hcloud.

Impact

Public IP is not assigned to the server making it unreachable if there is no fall-back to IPv4.

Environment and steps to reproduce

  1. Following the guide in https://www.flatcar.org/docs/latest/installing/cloud/hetzner/
  2. Create a basic server like
resource "hcloud_server" "example" {
  name        = "example"
  image       = var.flatcar_hcloud_oem_snapshot
  server_type = "cx23"
  public_net {
    ipv4_enabled = false
    ipv6_enabled = true
  }
}

Expected behavior

OEM should use the IPV6ADDR, default gateway and DNS from http://169.254.169.254/hetzner/v1/metadata/network-sysconfig and assign it to the default network interface (eth0).

Additional information

As a workaround, a systemd job can be created to inject the network config on runtime:

---
variant: flatcar
version: 1.1.0

storage:
  files:
    - path: /opt/bin/hcloud-ipv6.sh
      mode: 0755
      contents:
        inline: |
          #!/bin/sh
          set -eu

          IPV6ADDR=$(curl -fsSL http://169.254.169.254/hetzner/v1/metadata/network-sysconfig | grep IPV6ADDR | sed -E 's/IPV6ADDR=(.*)$/\1/')

          cat <<EOF > /etc/systemd/network/static.network
          [Match]
          Name=eth0

          [Network]
          Address=$IPV6ADDR
          DHCP=ipv4
          Gateway=fe80::1
          EOF

systemd:
  units:
    - name: hcloud-ipv6.service
      enabled: true
      contents: |
        [Unit]
        Description=Configure IPv6 from Hetzner metadata
        After=network-pre.target
        Before=network.target

        [Service]
        Type=oneshot
        ExecStart=/opt/bin/hcloud-ipv6.sh

        [Install]
        WantedBy=multi-user.target

But this is far from ideal.

Maybe there is even an IPv6 endpoint for the metadata API but I couldn't find one in the docs.

x4e-jonas avatar Dec 10 '25 09:12 x4e-jonas

Hello, thanks for your issue. Can you access the console to show what networctl status eth0 gives? (For what is worth, there's a similar request on the Afterburn side: https://github.com/coreos/afterburn/issues/1141).

Booting a qemu instance with IPv6 only gives me:

core@localhost ~ $ ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
core@localhost ~ $ ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fe80::5054:ff:fe12:3456/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever

tormath1 avatar Dec 10 '25 10:12 tormath1

# networctl status eth0
● 2: eth0
                   Link File: /usr/lib/systemd/network/98-virtio.link
                Network File: /usr/lib/systemd/network/zz-default.network
                       State: routable (configured)
                Online state: online
                        Type: ether
                        Path: pci-0000:01:00.0
                      Driver: virtio_net
                      Vendor: Red Hat, Inc.
                       Model: Virtio 1.0 network device
           Alternative Names: enp1s0
            Hardware Address: 92:00:06:***
                         MTU: 1500 (min: 68, max: 65535)
                       QDisc: pfifo_fast
IPv6 Address Generation Mode: eui64
    Number of Queues (Tx/Rx): 1/1
            Auto negotiation: no
                     Address: 100.65.*** (DHCPv4 via 172.31.1.1)
                              fe80::9000:6ff:***
           Activation Policy: up
         Required For Online: yes
            DHCPv4 Client ID: IAID:0x***/DUID
          DHCPv6 Client DUID: DUID-EN/Vendor:***

*** systemd-networkd[799]: eth0: found matching network '/usr/lib/systemd/network/zz-default.network', based on potentially unpredictable interface name.
*** systemd-networkd[799]: eth0: DHCPv4 address 100.65.***/32, gateway 172.31.1.1 acquired from 172.31.1.1
*** systemd-networkd[799]: eth0: Gained IPv6LL
*** systemd-networkd[1323]: eth0: found matching network '/usr/lib/systemd/network/zz-default.network', based on potentially unpredictable interface name.
*** systemd-networkd[1323]: eth0: Configuring with /usr/lib/systemd/network/zz-default.network.
*** systemd-networkd[1323]: eth0: Link UP
*** systemd-networkd[1323]: eth0: Gained carrier
*** systemd-networkd[1323]: eth0: found matching network '/usr/lib/systemd/network/zz-default.network', based on potentially unpredictable interface name.
*** systemd-networkd[1323]: eth0: DHCPv4 address 100.65.***/32, gateway 172.31.1.1 acquired from 172.31.1.1
*** systemd-networkd[1323]: eth0: Gained IPv6LL

x4e-jonas avatar Dec 10 '25 11:12 x4e-jonas

@tormath1: that's a link-local ipv6 address, not globally routable.

@x4e-jonas: does Hetzner rely on SLAAC or DHCPv6? I would have expected Flatcar to support SLAAC out of the box....

jepio avatar Dec 10 '25 14:12 jepio

(cc @apricote, if you have some leads / ideas on this ⏫)

tormath1 avatar Dec 10 '25 15:12 tormath1

does Hetzner rely on SLAAC or DHCPv6?

None of the two. Only static AFAIK.

x4e-jonas avatar Dec 10 '25 18:12 x4e-jonas