Stateless Adress Autoconfiguration allows a node on the link to automatically configure global IPv6 addresses by appending its interface identifier (64 bits) to the prefix (64 bits) advertised by the router.
Lets assume I have a server with the global IPv6 Adress
Now i want to add another global IPv6 address to the same interface by changing just the interface identifier and keeping the prefix. e.g.
How can i do that using SLAAC, where the interface identifier is automatically appended to the network prefix? I am currently using Ubuntu.
(This is similar to what the IPv6 Privacy Extension does, but i want to control adding and removing temporary IPv6 addresses myself.)
Privacy Extensions are exactly what you're looking for. You just want to have some manual control over them. You can manipulate the expiration and generation by using the
ip address command. The
ip-address man page says:
mngtmpaddr (IPv6 only) make the kernel manage temporary addresses created from this one as template on behalf of Privacy Extensions (RFC3041). For this to become active, the use_tempaddr sysctl setting has to be set to a value greater than zero. The given address needs to have a prefix length of 64. This flag allows to use privacy extensions in a manually configured network, just like if stateless auto-configuration was active.
At the moment, I'm not aware of any method for manually causing the system to switch to a new temporary address.
However, you can tune the time period in which a temporary address is used and cause the system to create them more frequently.
From the kernel documentation:
temp_valid_lft - INTEGER
valid lifetime (in seconds) for temporary addresses.
Default: 604800 (7 days)
temp_prefered_lft - INTEGER
Preferred lifetime (in seconds) for temporary addresses.
Default: 86400 (1 day)
(Yes, the misspelling is intentional...)
So, let us say you want the system to start using a new temporary address every 10 minutes. You will then set:
The other sysctl,
temp_valid_lft, allows some extra time for existing connections using a temporary address to finish up. You can also reduce this, especially if you don't anticipate long running connections. Here I reduce it to 1 hour: