Enable IPv6 on a Scaleway VPS After a Reboot

Posted on October 6, 2018 at 9:21 pm

If you have a Scaleway VPS with IPv6 enabled, you may have noticed that after a reboot the public (global) IPv6 address is not present. So after each reboot you may need to run this bash script to re-enabled the public IPv6 address (inet6 2001:*):

#!/bin/bash
# Load all IPv6 setting from the metadata service
IPV6_NETMASK=$(scw-metadata IPV6_NETMASK)  
IPV6_GATEWAY=$(scw-metadata IPV6_GATEWAY)  
IPV6_ADDRESS=$(scw-metadata IPV6_ADDRESS)  
# Add your IPv6
ip addr add ${IPV6_ADDRESS}/${IPV6_NETMASK} dev ens2
# Add your default IPv6 gateway
ip -6 r add default via ${IPV6_GATEWAY} dev ens2

* Change ens2 to your network adapter name (i.e eth0) if needed *

Copy the content above on /root/enable-ipv6.bash

Set execution permission with chmod +x enable-ipv6.bash

Run the script with /root/enable-ipv6.bash

Done! No need to reboot the VPS.

Then type ifconfig to make sure the public IPv6 is active.

Look for inet6 2001:*

Bonus Tip: Automate this with /etc/crontab

Add this line on /etc/crontab file:

@reboot root /root/enable-ipv6.bash

So /root/enable-ipv6.bash will be executed at every reboot.

References:

Introducing Native IPv6 Connectivity on Scaleway

Receive updates via email

Other Posts

Updated Posts