Skip to main content

Enabling IPv6 on Oracle Cloud Instance

I have a couple of always-free compute instances on Oracle Cloud. By default, each instance gets an IPv4 address, and IPv6 is not enabled.

I tried enabling IPv6 using instructions I found on the Internet, but:

  • it doesn't work for my Oracle Linux 8.4 instance
  • even if it did, we have to manually obtain the IPv6 address using /etc/rc.local -- this doesn't seem to be the best practice, especially since this is a systemd distro

Hey, I'm all for simplicity and I love SysV init scripts, but if the distro is a systemd distro, then I'll use systemd. Just like the reason why I have an Oracle Linux instance on Oracle Cloud -- it's supposed to be the best-supported OS on their cloud. Yes, it's just another clone of RHEL, but I thought it would somehow be better tuned for Oracle Cloud environment...

Anyway, I do have a Ubuntu instance on Oracle Cloud, and it's much easier to set up and figure out as you can see below.

Enable and assign IPv6 to the instanceโ€‹

This is done from on the cloud infrastructure, and can be easily done using the Cloud Console. These instructions are taken from the aforementioned article.

Once logged in to the Cloud Console, open the instance to be configured and perform the following actions:

  1. Configure VCN:

    1. CIDR Blocks: add an IPv6 CIDR block

    2. Subnets: Edit -> enable the CIDR block

  2. Configure Security List:

    • Ingress Rules: add IPv6-ICMP type 128 to allow incoming ping (from ::/0)

    • Egress Rules: allow traffic of all protocols to all destinations (::/0)

  3. Configure Route Table: Route Rules -> add IPv6 route rule to ::/0 targeting the default Internet Gateway

  4. Configure VNIC: IPv6 Addresses -> assign an IPv6 address

At this point, an IPv6 address has been assigned to the instance, and the network has been set up properly.

If you add new instances into the same VCN, then you would only need to assign a new IPv6 address to the VNIC, no need to reconfigure the other resources (CIDR Blocks, subnets, security lists, route table).

Obtain the IPv6 address from the instanceโ€‹

Next, obtain the IPv6 address from within the instance itself.

Oracle Linux 7.9โ€‹

dhcpv6-client service is already enabled by default.

Create a new file /etc/cloud/cloud.cfg.d/99_ipv6.cfg:

version: 2
dhcp: true
dhcp6: true

TODO: somehow my Ampere instance doesn't work yet

Oracle Linux 8โ€‹

SSH into the instance, and add DHCPv6 service to the firewall:

$ sudo firewall-cmd --add-service=dhcpv6-client

Check that the firewall setting have been applied properly:

$ sudo firewall-cmd --list-all

Tell NetworkManager to obtain the IPv6 address:

$ sudo systemctl restart NetworkManager

Wait a few seconds, and then check to see that the IPv6 address has been obtained successfully. We need to wait a few seconds because dhclient needs some time to obtain and then apply the IPv6 address.

$ ip add

If all is well, make the firewall rule permanent:

$ sudo firewall-cmd --add-service=dhcpv6-client --permanent

I actually wasted a few hours trying to find this information. It turns out DHCP was blocked by default and we need to allow it. Not sure why most people recommend setting the IPv6 statically...

Moral of the story: read the official documentation!


SSH into the instance, and reload the network configuration:

$ sudo systemctl restart systemd-networkd

That's it. It's much simpler isn't it? :)

P.S. on my Ampere instance, the IPv6 is applied almost as soon as I configured it.