Linode automatically assigns servers IPv6 addresses using SLAAC, but unlike the auto-assigned IPv4 addresses, you can’t transfer these addresses between Linodes. When running an email server with something like Mail-in-a-Box, this is a problem for updating to new major versions of the software or restoring to a new Linode from a backup. Ideally, you’d like to keep your IP addresses the same to minimise the amount of change during an update and to keep the good reputation you built with your address.
Work around this by requesting an IPv6 block from Linode and using an address from that block for your mail server, instead of the SLAAC address. If you’ve already started using a SLAAC address for your Linode, it’s too late for this, but you can always do it so you’re prepared for next time.
- From your box’s page in the Linode Manager, go to the Network tab. Click “Add an IP Address”, and select IPv6 /64. This gives your box 18 quintillion addresses to use. (We’ll only use one!)
- Again in the Linode Manager, switch to the Configurations tab and edit the default config for your box. Turn off the option “Auto-configure networking” – this stops our custom IPv6 configuration being overwritten every time the Linode reboots.
-
SSH into your Linode and manually configure a new public IPv6 address from the assigned range.
This boils down to editing the file
/etc/systemd/network/05-eth0.network
and addingAddress=[ip-address]/[prefix]
to statically assign your box an extra IPv6 address as well as the one it gets via SLAAC. So, if you were assigned the block2001:db8:e001:1b8c::/64
, you could use the address2001:db8:e001:1b8c::1
as the public IPv6 address for your mail server, and the line you add to the config file would beAddress=2001:db8:e001:1b8c::1/64
. - Restart your box to make sure the address is assigned correctly (both within Ubuntu and Linode’s infrastructure).
-
If you’ve already installed Mail-in-a-Box, edit the file
/etc/mailinabox.conf
and change the public IPv6 address to your new static address. Leave the private IPv6 address as the SLAAC address. Then runsudo mailinabox
and go through the configuration again.Otherwise, install Mail-in-a-Box now.
In both cases, the log output should show the public IPv6 address as the one you selected from the new /64, and the private IPv6 address as the SLAAC one.
- If you use external DNS, update the AAAA record for your box to be the new public IPv6 address.
- Back in the Linode Manager, in your box’s Network tab, select “Edit RDNS” for your IPv6 range and add an entry which maps the new public IPv6 address to your box’s hostname.
Now when it comes time to change boxes, you can contact Linode Support and ask them to move your IPv6 range to the new Linode for you.