Exoscale Compute instances can optionally feature a public IPv6 address, either upon creation or afterward. This address is partially derived from the instance’s MAC address, which is unique. Therefore, the IPv6 address is tied to the instance itself. When you destroy the instance, you release the public IPv6 address forever.

However, sometimes having a persistent IPv6 address is desirable. For example, needing to employ multiple IPv6 addresses for the same use case.

Elastic IPv6 prefix is a Compute resource that creates an entire IPv6 prefix (with prefix length /96) to your organization. You can then attach that prefix to one or several instances in addition to their primary IPv6 address. These instances need to have IPv6 enabled. Attaching multiple Elastic IPv6 prefixes for your organization is possible.

Elastic IPv6 prefix differs from its IPv4 counterpart in that it contains more than 4 billion addresses. All addresses within that IPv6 prefix are available to use according to your instances’ networking needs.

Creating a Elastic IPv6 prefix

To use a Elastic IPv6 prefix, the first step is to allocate it. This can be achieved via the Portal, the CLI or the API.

Create a Manual Elastic IPv6 prefix

To create an Elastic IPv6 prefix via the CLI, you need to specify IPv6 create --ipv6 and your chosen zone. This is what it looks like in the CLI:

# Mind the --ipv6 flag
$ exo compute elastic-ip create --ipv6 --zone at-vie-1
 ✔ Creating Elastic IP... 4s
┼────────────────┼──────────────────────────────────────┼
│   ELASTIC IP   │                                      │
┼────────────────┼──────────────────────────────────────┼
│ ID             │ 1eabae57-50c9-4368-a591-8695cbfe37ce │
│ IP Address     │ 2a04:c45:c00:3a46:500:2:0:1          │
│ Address Family │ inet6                                │
│ CIDR           │ 2a04:c45:c00:3a46:500:2::/96         │
│ Description    │                                      │
│ Zone           │ at-vie-1                             │
│ Type           │ manual                               │
┼────────────────┼──────────────────────────────────────┼

The Elastic IPv6 prefix is visible in the CIDR field, while a reference IPv6 address within that prefix is displayed in the IP Address field. Note that the whole prefix is usable.

Create a managed Elastic IPv6 prefix, backed by a health check

$ exo compute elastic-ip create \
 --ipv6 \
 --zone at-vie-1 \
 --healthcheck-mode tcp \
 --healthcheck-port 80
 ✔ Creating Elastic IP... 3s
┼──────────────────────────┼──────────────────────────────────────┼
│        ELASTIC IP        │                                      │
┼──────────────────────────┼──────────────────────────────────────┼
│ ID                       │ 19f2cc9a-e7a7-4e03-b32c-525c123f4eb2 │
│ IP Address               │ 2a04:c45:c00:3a46:500:3:0:1          │
│ Address Family           │ inet6                                │
│ CIDR                     │ 2a04:c45:c00:3a46:500:3::/96         │
│ Description              │                                      │
│ Zone                     │ at-vie-1                             │
│ Type                     │ managed                              │
│ Healthcheck Mode         │ tcp                                  │
│ Healthcheck Port         │ 80                                   │
│ Healthcheck Interval     │ 10s                                  │
│ Healthcheck Timeout      │ 3s                                   │
│ Healthcheck Strikes OK   │ 3                                    │
│ Healthcheck Strikes Fail │ 2                                    │
┼──────────────────────────┼──────────────────────────────────────┼

As seen above, in order to create a managed Elastic IPv6 prefix, you also have to provide the required health check parameters. Without those parameters, an Elastic IPv6 manual type will be created.

Attach an Elastic IPv6 prefix to an instance

After the Elastic IPv6 prefix has been created, you can then attach it to one or more Compute instances.

To refer to a Elastic IPv6 prefix, use either its unique ID or the reference IPv6 address, as you can see here in the CLI:

➜  russell ~  exo c elastic-ip show 4ef39790-3409-4b2b-aa44-672db338edd5 -z at-vie-1
┼────────────────┼──────────────────────────────────────┼
│   ELASTIC IP   │                                      │
┼────────────────┼──────────────────────────────────────┼
│ ID             │ 4ef39790-3409-4b2b-aa44-672db338edd5 │
│ IP Address     │ 2a04:c45:c00:3a46:500:2:0:1          │
│ Address Family │ inet6                                │
│ CIDR           │ 2a04:c45:c00:3a46:500:2::/96         │
│ Description    │                                      │
│ Zone           │ at-vie-1                             │
│ Type           │ manual                               │
┼────────────────┼──────────────────────────────────────┼

Attach the Elastic IPv6 prefix like this:

$ exo compute instance elastic-ip attach my-instance 4ef39790-3409-4b2b-aa44-672db338edd5 -z at-vie-1
 ✔ Attaching Elastic IP "4ef39790-3409-4b2b-aa44-672db338edd5" to instance "my-instance"... 3s
┼──────────────────────┼──────────────────────────────────────┼
│   COMPUTE INSTANCE   │                                      │
┼──────────────────────┼──────────────────────────────────────┼
│ ID                   │ 8a7dd501-ccc4-4582-867a-347e14bf43ff │
│ Name                 │ my-instance                          │
│ Creation Date        │ 2022-08-25 14:23:04 +0000 UTC        │
│ Instance Type        │ standard.medium                      │
│ Template             │ Linux Ubuntu 20.04 LTS 64-bit        │
│ Zone                 │ at-vie-1                             │
│ Anti-Affinity Groups │ n/a                                  │
│ Security Groups      │ default                              │
│ Private Networks     │ n/a                                  │
│ Elastic IPs          │ 2a04:c45:c00:3a46:500:2:0:1          │
│ IP Address           │ 185.150.8.7                          │
│ IPv6 Address         │ 2a04:c45:c00:3a46:4fa:70ff:fe00:4a   │
│ SSH Key              │ my-instance-1661437382               │
│ Disk Size            │ 50 GiB                               │
│ State                │ running                              │
│ Labels               │ n/a                                  │
┼──────────────────────┼──────────────────────────────────────┼

Traffic for any address within the Elastic IPv6 prefix is now routed to my-instance.

Please note: in the case of the manual Elastic IPv6, the user has to configure the address within the attached instances.

For the managed Elastic IPv6, traffic towards the reference IPv6 address is transparently forwarded, with no need for additional configuration. The whole Elastic IPv6 prefix is still routed to the attached instances. However, any other IPv6 addresses need to be configured within the instances.

Managed Elastic IPv6 prefix health check options

Health check options for managed Elastic IPv6 prefixes are the same as the IPv4 counterpart.

Configure IPv6 addresses within a Compute instance

As we described, for managed Elastic IPv6 prefix a single reference IPv6 address will be transparently forwarded to the attached instances without any configuration needed. For all the other cases, manual configuration is needed within the Compute instances.

Some common use cases are:

  • To employ a managed Elastic IPv6 prefix, and you need to use more IPv6 addresses than the reference address.
  • To employ a manual Elastic IPv6 prefix.

Warning

Do not remove the original IPv6 address of the compute instance, as Elastic IPv6 relies on it.

Configuration of additional IPv6 addresses within your Compute instance may vary depending the operating system. Some examples follow:

Ubuntu Jammy

In /etc/netplan/51-eip.yaml, put the following snippet.

---
network:
  version: 2
  renderer: networkd
  ethernets:
    lo:
      match:
        name: lo
      addresses:
        - 2a04:c45:c00:3a46:500:2::1337/128

And then, apply it with sudo netplan apply

Debian 11 (Bullseye)

In /etc/network/interfaces.d/51-eipv6 add the following snippet:

auto lo:1
iface lo:1 inet6 static
    address 2a04:c44:c00:3a46:500:2::1337/128

Then invoke ifup lo:1 to configure the IPv6 address on respective interface. For additional IPv6 addresses from the Elastic IPv6 prefix, use lo:2, lo:3, et cetera.

Manual Elastic IP as Traffic Source

There might be cases when you need to use IPv6 addresses from the Elastic IPv6 prefix as a source for egress traffic. You will need to either:

  • Configure the Elastic IPv6 addresses as binding addresses on the application level:

    For example with Postfix mail server you could use smtp_bind_address6 = 2001:240:587:0:250:56ff:fe89:1

  • Configure the Elastic IPv6 address as the preferred source on the system’s routing level.

    There are several ways to implement a preferred source at the level of routing, depending on the operating system and personal preference. Here are two examples with netplan and systemd-networkd, two popular networking options in the Linux world.

Modifying default IPv6 source address with netplan

Assuming you need to use 2a04:c44:c00:3a46:500:2::1337 as the source IPv6 address for all egress traffic:

sudo ip -6 address add 2a04:c44:c00:3a46:500:1:0:1337/128 dev lo

Then

cat <<EOF | sudo tee /etc/netplan/51-eipv6-source.yaml
---
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      routes:
        - to: default
          from: 2a04:c44:c00:3a46:500:2::1337
          via: $(ip -6 r show default | awk '{print $3}')
          metric: 99
EOF

and then invoke sudo netplan apply.

Modifying default IPv6 source address with systemd-networkd

Assuming you need to use 2a04:c44:c00:3a46:500:2::1337 as the source IPv6 address for all egress traffic:

sudo ip -6 address add 2a04:c44:c00:3a46:500:1:0:1337/128 dev lo

Then

debian@debianv6:~$ cat << EOF | sudo tee /etc/systemd/network/eth0.network
> [Match]
Name=eth0

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
IPv6AcceptRA=yes

[Route]
Destination=::/0
Gateway=_ipv6ra
PreferredSource=2a04:c44:c00:3a46:500:1:0:1337
Metric=99
EOF

and then invoke sudo systemctl restart systemd-networkd.

Limitations

  • Elastic IPv6 prefixes have the same limitations as Elastic IPs.
  • For managed Elastic IPv6 prefixes, only the first-plus-one IPv6 address of that prefix is transparently forwarded to the associated instances.