Why are IPv6 addresses flushed on link down?
It sounds like the setting you are looking for is keep_addr_on_down
which was introduced in Linux 4.6. Quoting Documentation/networking/ip-sysctl.txt:
keep_addr_on_down - INTEGER
Keep all IPv6 addresses on an interface down event. If set static
global addresses with no expiration time are not flushed.
>0 : enabled
0 : system default
<0 : disabled
Default: 0 (addresses are removed)
If you are using an older Linux version than 4.6 the best workaround I can suggest is to assign the address to a dummy
interface which you keep up even if the physical interface is brought down:
modprobe dummy
ip -6 addr add dev dummy0 2001:db8::42/128