I want to use a raspberry pi as ipv6 dns server for local (LAN) use. I would then make it known in the router (Fritz!Box) for which I’d need the pi’s ipv6 address. Problem: this ip address keeps changing and I can’t figure out how to make a setup that survives reboots of the pi.

I used a fe80:: address which lasted for several weeks until I had to restart the pi.

I just can’t figure out how this whole ip address assignment is supposed to work for ipv6. Everything is dynamic but I somehow need to make the server known to the router. Writing scripts can’t be the solution in my mind. There’s something in the whole concept I don’t get.


Here’s what my pi currently shows, only the last fe80 address seems to be somewhat stable:

 raspberrypi> ip addr show dev wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether dc:a6:32:38:8c:21 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute wlan0
       valid_lft 857987sec preferred_lft 749987sec
    inet6 fd45:dcb2:b03a:d048:7340:186b:1b24:8b2b/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 1792sec preferred_lft 1792sec
    inet6 fd00::afdc:b54a:7fd2:5077/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 7013sec preferred_lft 3413sec
    inet6 2a02:redacted:d276:183c:6da3:a4fb/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 4727sec preferred_lft 2027sec
    inet6 fe80::45c:5592:e1e9:d92c/64 scope link 
       valid_lft forever preferred_lft forever
  • So what software are you running to manage your DNS? Post the configuration file for the server.
    – Ramhound
    Apr 4 at 10:51
  • Not sure I understand. The dns server is a pihole but I don’t think this is relevant here. The pi starts up, its interfaces get ip addresses (ipv4 via DHCP from the router, ipv6 by ipv6 magic). I need to enter a valid ipv6 address in the router interface (WEBGUI). I can take something manually from the ifconfig output but this is hardly practical.
    – hk1020
    Apr 4 at 11:04
  • It’s absolutely relevant
    – Ramhound
    Apr 4 at 11:09

1 Answer 1


It works not too differently from IPv4. You can have static addresses; you can have dynamic addresses that are stable; and you can have dynamic addresses that are not stable. (For example, in IPv4, you can have a dynamic – DHCP – address that remains the same for as long as the DHCP lease exists.)

Regular IPv6 addresses are assigned in two ways:

  • The device uses DHCPv6 to obtain an address lease; or

  • The device uses "SLAAC" (stateless autoconfiguration) – it learns the address prefix from a periodic Router Advertisement from your router, then combines it with an address suffix ("interface ID") of its own choice.

Most networks use the second method, although DHCPv6 can be found in places, but pure DHCPv6-only networks are mostly corporate – in a home network it would still run together with SLAAC.

Link-local fe80:: addresses use something similar to the second method, except there's no Router Advertisement because the prefix is always known (not to mention unroutable).

Generally link-local addresses should be used only for automatic mechanisms, e.g. when the device advertises itself; for other things use a normal address. Since they all consist of two parts (prefix and interface ID), there are two things to consider:

  • Stability of the address prefix. The prefix is mostly equivalent to the "" that you would have in IPv4, only in IPv6 you also have a global one.

    You will often have addresses from two prefixes (not counting link-local) – some from your ISP-issued prefix (2xxx:) and some from a local, router-generated prefix (fdxx:). The ISP-issued prefix depends entirely on your ISP's whims; it might be permanent or it might change daily. The router-generated local prefix is usually permanent unless the router is reset, so that's what you should be using for internal communications.

  • Stability of the interface ID. For DHCPv6 this is issued by the router, just like in IPv4; for SLAAC it's generated by the device alone.

    For SLAAC, the primary interface ID is either based on the MAC address or some kind of a hash of MAC + network prefix + /etc/machine-id, or similar. As long as you're on the same network and your Raspberry Pi isn't losing its /etc or /var/lib every time, you should always end up with a stable interface ID and therefore a stable IPv6 address.

    For DHCPv6, it's received as part of the DHCP lease, and your Pi should be getting the same lease as long as it can store the DUID in /etc.

    Finally, if the network prefix is stable, you can always configure the whole IPv6 address statically instead of relying on SLAAC/DHCPv6.

    You might also see additional addresses marked as 'temporary' in ip addr. Ignore those; they're temporary, just as the flag indicates, and aren't useful for your purposes. (Also ignore the entire ifconfig command – it shows you only 10% of the information.)

So if you want a stable address:

  1. Check what network prefixes you have (the first half of each IPv6 address). Repeat after some restarts, to check whether any of the prefixes are stable.

  2. Figure out which software your Raspberry Pi uses to get those addresses – dhcpcd? systemd-networkd? NetworkManager? connman? in-kernel built-in autoconfiguration?

  3. Search its docs to see how to make it use an "EUI64" (MAC-address-based) interface ID. (This is maybe not the ideal choice, but it is always stable with the least amount of work.)

    Or, alternatively, search how to set an "interface token" (which is basically a static interface ID); or how to disable stateless auto-configuration and set up an entirely static IPv6 address.

  • Thank you very much for your very exhaustive answer. So there are three prefixes: ISP (not useful here), fdXX, and fe80. Only fe80 seem to be kind of stable. For the rest I need to investigate what debian buster on a pi uses to get the address? I am still trying to make sense of it all. I’ll add my current ip addr output to my question.
    – hk1020
    Apr 4 at 11:42
  • I would be surprised if the fdXX prefix was not stable: literally the whole reason your router even provides it is to have a stable internal-use prefix when the ISP refuses to give one. So I would still recommend that first. The prefix is usually the first half of the address – either the fd45:dcb2:b03a:d048: or the fd00::, you for some reason have two? – if at least one of them is stable, then the instability of the suffix can be investigated separately. Apr 4 at 11:51
  • Don’t know why there are two. Checked the router but couldn’t find a reference to a fd45 prefix. And what happens to the suffix? If I remember correctly it also changed at some point. Seems like I actually need to make actual experiments. And then there is the DHCPv6 server built into the router. Doesn’t make it any easier…
    – hk1020
    Apr 4 at 12:07

You must log in to answer this question.

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