Setting up IPv6 on Ubuntu 18.04

How to Configure IPv6 on Ubuntu 18.04

Last updated on

This article particularly relates to setting up IPv6 on an existing DigitalOcean Droplet, however, it should also be useful to anyone wanting to set up IPv6 on Ubuntu 18.04. Unlike earlier versions of Ubuntu, version 18.04 does not use /etc/networking/interfaces to configure IPv6 network settings. Instead, you must use netplan .

If you are creating a new Droplet, you do not have to do any manual configuration. Instead, just check the IPv6 box when you are creating a new Droplet.

If you are trying to enable IPv6 on an existing DigitalOcean Droplet, you should now shutdown the Droplet and create an image/backup.

WARNING: It’s very important that you have a complete backup of your server because if you mess up the network settings, you may never be able to log back in again.

Shutdown Ubuntu

sudo shutdown -h now

Now you can go the the Networking tab for your Droplet and enable Public IPv6 network

Digital Ocean IPv6 Enable setting

After a minute, you will be presented with your new IPv6 addresses

New IPv6 addresses

Turn on your Droplet again and log in to SSH.

Use nano to edit the file /etc/netplan/50-cloud-init.yaml

sudo nano /etc/netplan/50-cloud-init.yaml

The config with no IPv6 settings will look similar to below:

/etc/netplan/50-cloud-init.yaml
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 167.99.223.163/20
            - 10.18.0.6/16
            gateway4: 167.99.208.1
            match:
                macaddress: aa:9e:5c:98:97:e4
            nameservers:
                addresses:
                - 67.207.67.2
                - 67.207.67.3
                search: []
            set-name: eth0

You will need to add your IPv6 address, IPv6 gateway and IPv6 nameservers to this configuration. These details should be in your Droplet’s networking tab.

  • PUBLIC IPV6 ADDRESS:
    2a03:b0c0:2:d0::d76:c001
  • PUBLIC IPV6 GATEWAY:
    2a03:b0c0:2:d0::1

We also need the Google Public DNS nameservers

  • Google Public DNS nameserver 1
    2001:4860:4860::8844
  • Google Public DNS nameserver 2
    2001:4860:4860::8888

With this information, add them to the config:

Warning reminder: Did you backup or make an image of your server? Because if the settings are wrong, you may get locked out permanently!

/etc/netplan/50-cloud-init.yaml
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 167.99.223.163/20
            - 2a03:b0c0:2:d0::d76:c001/64
            - 10.18.0.6/16            
            gateway4: 167.99.208.1
            gateway6: 2a03:b0c0:2:d0::1
            match:
                macaddress: aa:9e:5c:98:97:e4
            nameservers:
                addresses:
                - 2001:4860:4860::8844
                - 2001:4860:4860::8888
                - 67.207.67.2
                - 67.207.67.3
                search: []
            set-name: eth0

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Now apply these settings using netplan.

sudo netplan apply

Now do a test IPv6 ping to Google’s Public DNS server

ping6 2001:4860:4860::8888

If IPv6 is working correctly, you should see some ping responses.

PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=61 time=0.897 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=2 ttl=61 time=0.562 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=3 ttl=61 time=0.607 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=4 ttl=61 time=0.613 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=5 ttl=61 time=0.541 ms

If you have access to another machine, try pinging your server’s IPv6 address. Just keep in mind that if your client or ISP does not yet support IPv6, the ping will fail.

1 Star2 Stars3 Stars4 Stars5 Stars 4.20 (5 votes)

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

4 replies

avatar
  Subscribe  
newest oldest
Notify of
Anthony
Guest
Anthony
Anthony
2 months ago

Thanks, I love you. I spent so long trying to figure this out. Have any idea what that private IPv4 address is? Doesn’t seem to match the private IP of my droplet.

Tero
Guest
Tero
Tero
1 year ago

Thank you. This helped me a lot!

Josh
Guest
Josh
Josh
1 year ago

Thanks so much!! The “official” DigitalOcean guide didn’t work for me but this did!