I would like to add an extra IPv6 address so I can run a service on it but I want to retain the existing IPv6 address as the address to use for outgoing connections.
When I add an ipv4 address with
ip addr add <address> dev <device>
It gets added as "secondary" and is not used by default for outgoing connections but when I do the same for ipv6 the address is just added as a normal address and (all else being equal) linux uses the most recently added address for outgoing connections.
There appears to be a "deprecated" flag which can mark an IPv6 address as non-default but there doesn't seem to be any obvious way to set it.
Show us an output from ip and tell us how and where you see an address is "primary" and/or "secondary".
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 68:b5:99:78:63:d4 brd ff:ff:ff:ff:ff:ff inet 18.104.22.168/26 brd 22.214.171.124 scope global bond0 inet 126.96.36.199/26 scope global secondary bond0 inet6 2001:41c9:1:3ce::11/64 scope global valid_lft forever preferred_lft forever inet6 2001:41c9:1:3ce::10/64 scope global valid_lft forever preferred_lft forever inet6 fe80::6ab5:99ff:fe78:63d4/64 scope link valid_lft forever preferred_lft forever
The extra IPv4 address is shown as "secondary" and is not used by default for outgoing connections but the extra IPv6 address is just listed the same as the first address and is chosen by default for outgoing connections.