Elastic IPv6 Prefixes
Exoscale instances can optionally feature a public IPv6 address (either upon creation or afterwards). This address is partially derived from the instance’s MAC address, which is unique. Therefore, the IPv6 address is tied to the virtual machine 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 (EIPv6) 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 Compute instances in addition to their primary IPv6 address. These instances need to be already IPv6 enabled. Attaching multiple EIPv6 prefixes for your organization is possible.
EIPv6 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 EIPv6 prefix
To use a EIPv6 prefix, the first step is to allocate it. This can be achieved via all supported means, be it our web application, our CLI, or API.
Create a manual EIPv6 prefix
To create a EIPv6 prefix via 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 EIPv6 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 EIPv6 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 EIPv6 prefix, you also have to provide the required health check parameters. Without those parameters, an EIPv6 of type manual will be created.
Attach an EIPv6 prefix with a Compute instance
Once the EIPv6 prefix has been created, you can then attach it to one or more Compute instances.
To refer to a EIPv6 prefix, use either its unique ID or the reference IPv6 address, as seen in:
➜ 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 EIPv6 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 EIPv6 prefix is now routed to my-instance
.
Please note: in the case of the manual EIPv6, the user has to configure the address within the attached instances.
For the managed EIPv6, traffic towards the reference IPv6 address is transparently forwarded, with no need for additional configuration. The whole EIPv6 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 address(es) within a Compute instance
As described earlier, for managed EIPv6 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:
- Employing a managed EIPv6 prefix and you need to use more IPv6 addresses than the reference address.
- Employing a manual EIPv6 prefix.
Warning
You must not remove the original IPv6 address of the compute instance as EIPv6 relies on it.
Configuring additional IPv6 address(es) 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: 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 EIPv6 prefix, use lo:2
, lo:3
, etc.
CentOS 7
In /etc/sysconfig/network-scripts/ifcfg-lo:1
add the following snippet:
DEVICE=lo:1
IPV6ADDR=2a04:c44:c00:3a46:500:2::1337/128
ONBOOT=yes
NAME=lo1
Then invoke ifup lo:1
to configure the IPv6 address on respective interface.
For additional IPv6 addresses from the EIPv6 prefix, use lo:2
, lo:3
, etc.
Manual EIP as Traffic Source
There might be cases when you need to use IPv6 address(es) from the EIPv6 prefix as source for egress traffic. To this end you need to either:
-
configure the EIPv6 address(es) 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 EIPv6 address as 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 taste. Hereafter we provide two examples with
netplan
andsystemd-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 you should:
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 you should:
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
EIPv6 prefixes have the same limitations as Elastic IPs.