Overview

Situation

An internet connection which uses native IPv6 and supports IPv4 through Dual-Stack Lite. The internet provider assigns the Fritz!Box an IPv6 prefix (/59).

A server running Debian 12 should be publicly reachable to provide some services. Due to the Dual-Stack Lite, IPv6 is the only way to publicly expose the server. In the Fritz!Box a corresponding fort forwarding is configured.

Problem

There’s no control over the assigned IPv6 prefix and it might change whenever the internet connection gets reconnected. As the server has a static local IPv4 address, the second part of the IPv6 address should also be static.

In any case, for a stable domain, dynamic DNS is required.

Solutions

ifupdown

A working, but not ideal solution.

Every time the prefix changes the configuration needs to be adjusted. Subsequently the network needs to be restarted or the server needs to be rebooted.

/etc/network/interfaces
auto enp1s0

iface enp1s0 inet static
  address 192.168.178.5
  netmask 255.255.255.0
  gateway <IPv4 address of Fritz!Box>

iface enp1s0 inet6 static
  pre-up modprobe ipv6
  address <prefix>:192:168:178:5
  netmask 64

This might be scriptable to some extent, but is also error-prone.

NetworkManager

NetworkManager is able to automatically change the prefix.

For this to work, the Fritz!Box needs to announce the prefix. In the webinterface the setting is avalailable under: Home Network > Network > IPv6 Settings > DHCPv6 Servers in the Home Network > Assign DNS server and prefix (IA_PD).

The configuration for NetworkManager looks like the following:

/etc/NetworkManager/system-connections/enp1s0.nmconnection
[connection]
id=enp1s0
type=ethernet
interface-name=enp1s0

[ipv4]
method=manual
address1=192.168.178.5/24,<IPv4 address of Fritz!Box>

[ipv6]
method=auto
addr-gen-mode=eui64
token=::192:168:178:5

The connection can be enabled with nmcli connection reload and nmcli connction up enp1s0.