[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: force IPv6 dynamic address?



Hello,

On Wed, Mar 23, 2022 at 05:11:31AM +0800, Jeremy Ardley wrote:
> How can I make my system and/or thunderbird use the constantly changing
> dynamic IPv6 address instead?

If you add your static address with a preferred_lft of 0 then it
will be marked as "deprecated" which means it will never be chosen
as a source address unless forced to be. It will still be fully
usable in all other senses.

In /etc/network/interfaces:

iface eth0 inet6 static
    address 2001:db8:1:2::3
    netmask 64
    post-up ip addr change 2001:db8:1:2::3/64 dev $IFACE preferred_lft 0

Also, longest prefix will be selected as source address, so if you
add a /128 that will tend to be used.

The full rules for IPv6 source address selection are in RFC 6724…
which does say that temporary addresses should be preferred by
default, so I'm not sure why that's not happening for you.

It may depend on the value of the sysctl
/proc/sys/net/ipv6/conf/*/use_tempaddr. If that is 1 then temporary
addresses will be available but not forced to be used. >1 means they
are preferred, so it might be that.

Finally, you can also override it with a route entry:

# ip -6 route change default src 2001:db8:1:2::3

or for a specific net

# ip route add 2001:db8:99::/48 via <your normal default gw is> src 2001:db8:1:2::3

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: