How to configure IPv6 with Netplan on Ubuntu 18.04

Estimated reading time: 1 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

  • Root user or a user which has root privileges to make changes to the network interface.
  • Working SSH connection to the server
  • The knowledge that Ubuntu 18.04 is switched to netplan for network configurations.

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 support@snel.com in order the get the required information for configuring your server with IPv6.

Step 2 - Log in to your server

Open a terminal and log in to your server using SSH
$ 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.

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 0
Views: 155

Reader Interactions

Leave a Reply

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