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
Once logged in to the Cloud Console, open the instance to be configured and perform the following actions:
CIDR Blocks: add an IPv6 CIDR block
Subnets: Edit -> enable the CIDR block
Configure Security List:
Ingress Rules: add IPv6-ICMP type 128 to allow incoming ping (from
Egress Rules: allow traffic of all protocols to all destinations (
Configure Route Table: Route Rules -> add IPv6 route rule to
::/0targeting the default Internet Gateway
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
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.