How to configure IPv6 with Netplan on Ubuntu 18.04

Estimated reading time: 2 min

Introduction

Nowadays it became more important to configure your server with IPv6 and make it accessible via IPv6. To achieve this you can use this article to configure IPv6 for your Ubuntu server.

Prerequisites

To configure your machine, you’ll need to have a working SSH connection to the server. Because the modifications affect core system settings, you’ll need to have root privileges to make changes to the network interface. Finally, note that these instructions are for Ubuntu 18.04, so note that this version of Ubuntu switched to netplan for network configuration.

Step 1 – Contact Support for an IPv6

If you do not have an IPv6 address assigned, the first step is to send an email to [email protected] in order the get the required information for configuring your server with IPv6.

Step 2 – Log in to your server

You must be logged in via SSH as sudo or root user.

ssh root@ip_address_or_domain

Step 3 – Configure network configuration

Since Ubuntu 18.04 you can use Netplan to configure your network interfaces. This is a yaml based configuration file which is used to configure the network interface of your server. In our example, our yaml file has the following name

/etc/netplan/01-netcfg.yaml

and the filename can be different on your installation. Please inspect the configuration file below

network:  
    version: 2  
    renderer: networkd  
    ethernets:     
        ens18:        
            accept-ra: no        
                addresses:            
                    - 193.33.61.xxx/24        
                gateway4: 193.33.61.1        
                nameservers:            
                addresses: [89.207.128.252, 89.207.130.252]

Step 4 – Apply the changes

We can see that IPv4 is configured for this server. To add IPv6 we can add the IPv6 address with the prefix below the addresses also do not forget to add the IPv6 gateway. The configuration file should be similar to the config file below.

network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      accept-ra: no
      addresses:
        - 193.33.61.xxx/24
        - 2a00:7b80:454:2000::xxx/48
      gateway4: 193.33.61.1
      gateway6: 2a00:7b80:454::1
      nameservers:
        addresses: [89.207.128.252, 89.207.130.252]

 

Before changing the configuration file it’s recommended to check for syntax errors. This can be checked with

netplan try

You can also apply the changes without checking on syntax error

netplan apply

Step 5 – Verify IPv6 on your Server

The final step is to check whether the configured IPv6 is working. If your own working station is supporting IPv6 you can test it through your terminal. You can find the commands below per Operating System.

Windows:

ping -6 2a00:7b80:451:1::8

Linux:

ping6 2a00:7b80:451:1::8

MacOS:

ping6 2a00:7b80:451:1::8

 

Conclusion

If you followed this article you should have a working IPv6 address on your server. This allows you to enable IPv6 in software which supports IPv6. For example, you can serve now Websites via IPv6 connection.

Was this article helpful?
Dislike 17
Views: 82084

Reader Interactions

Comments

  1. Mr. Fenton says

    Your STEP 4 about showing what it should look like ''''BELOW'''' is not therwe. WASTE OF ALL PEOPLES TIME on what a WORKING IPV4 WITH IPV6 should look like!

      • Mr. Fenton says

        OK., Works for me on a desktop machine, though since prior to your update, I just read through the 'man' pages to get a mixture of your's to work with my brouted servers serving both static IPV4 and V6 together. Thanks for your help.

        ps. You Should lesson the US Government Google robot strength settings, training the government machines because it REALLY P*SSES people of clicking that TRASH 20 TIMES IN A ROW, wasting peoples time to make big brothers surveillance better fine tuned ..

Leave a Reply

Your email address will not be published. Required fields are marked *