Your router needs to be set to correctly send Router Advertisements (RA) to distribute the prefixes. We will use "ens18" as the example interface in this entry. To check if your router is configured correctly, you can use tcpdump:

$ sudo tcpdump -v -i ens18 icmp6 and ip6[40] == 134

This will also tell you the right prefixes.

Debian 12 Bookworm method:

Add the following config to the end of your /etc/network/interfaces

# Allowing IPv6 DHCP
iface ens18 inet6 dhcp

Then:

$ sudo systemctl restart networking

Debian 13 Trixie method:

First, install the package "ifupdown2".

You should check if your system is able to take the addess. Try it by using:

$ sudo ip -6 addr add IPV6ADDRESS/NETMASK dev ens18

Then, check if you got the address with "$ ip a". After the next reboot, the address will be gone. This is just a test. If this worked, you can now assign it permanently.

Use the following command to get the address of your gateway:

$ ip -6 route show default dev ens18

Then, add this config to the end of your /etc/network/interfaces

iface ens18 inet6 static
  address YOUR_ADDRESS
  netmask YOUR_NETMASK (in my case, 62)
  gateway YOUR_GATEWAY

Then restart the networking service:

$ sudo systemctl restart networking