I have a system with a primary IP address of 2001:DB8:1::1/64
. This IP is achieved via stateless auto config and is static for our purposes.
This system has a routed IP block of 2001:DB8:2::/64
.
I would like to ensure that by default, all IPv6 traffic originating from the system uses 2001:DB8:1::1
. (Applications could override this with a specific source binding.)
The best way to do this appears to be, from my research, to run
ip addrlabel add prefix 2001:DB8:1::1/128 label 1
ip addrlabel add prefix 2001:DB8:2::/64 label 99
What would be a proper Ubuntu way to have this run at startup?
Thanks to Anders input i was able to do this by adding the following lines, in /etc/network/interfaces
up /sbin/ip addrlabel add prefix 2001:DB8:1::1/128 label 1
up /sbin/ip addrlabel add prefix 2001:DB8:2::/64 label 99
...
down /sbin/ip addrlabel del prefix 2001:DB8:1::1/128 label 1
down /sbin/ip addrlabel del prefix 2001:DB8:2::/64 label 99
This works great, and also covers clean-up if the interface is brought down.
Best Answer
Add it to /etc/network/interfaces as a post-up to the interface.