We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Configure your Droplet to Only Use IPv6 Networking

Posted Jun 13, 2014 21.6k views Networking IPv6 DigitalOcean


DigitalOcean is now offering IPv6 addresses in select datacenters (starting with Singapore 1).

IPv6 is the most recent version of the IP protocol that the entire internet relies on to connect to other locations (IP protocol is a bit redundant because IP stands for internet protocol, but we will use it because it is easy). While IPv4 is still in use in many areas of the world, the IPv4 address space is being consumed at a rapid rate and it is not large enough to sustain the rapid deployment of internet-ready devices.

IPv6 looks to solve these problems. As well as making general improvements on the protocol, the most obvious benefit of utilizing IPv6 addresses is that it has a much larger address space. While IPv4 allowed for 2^32 addresses (with some of those reserved for special purposes), the IPv6 address space allows for 2^128 addresses, which is an incredible increase. To find out how to enable IPv6 on your Droplets follow the linked guide.

It is often desirable to have both IPv4 and IPv6 interfaces available on a single Droplet. This is the state of the Droplet after IPv6 has been enabled. However, for some purposes, you may wish to disable IPv4 entirely and rely solely on IPv6.

In this guide, we will discuss how to turn off IPv4 networking if you wish to only have IPv6 enabled. Most people will not need to do this, but there are situations where it may make sense. You will still need to have IPv4 available for the localhost so that your programs operate as expected. This is the scenario we will demonstrate.

Note: If you are connecting to your Droplet through an IPv4 connection, disabling the IPv4 interface will drop your connection! If this happens, you will need to either connect using IPv6 (if your local configuration supports it) or log in using the control panel.

Disabling IPv4 Temporarily

If you wish to disable IPv4 temporarily, you can do so by simply editing the /etc/resolv.conf file to use IPv6 DNS servers (if you enabled IPv6 during the Droplet's creation, this step should already be done) and then deleting the rule that configures your IPv4 address. These changes will be reverted next time you reboot.

First, edit your /etc/resolv.conf file if necessary:

sudo nano /etc/resolv.conf

If your nameservers configuration points to IPv4 addresses, you'll need to change those to IPv6 name servers instead. This will already be done if you enabled IPv6 when you initially created the Droplet.

If this isn't configured yet, you can set the directives to Google's IPv6 name servers by changing the file to look like this:

nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888

Save and close the file when you are finished.

Next, you'll need to see what your IPv4 address and CIDR routing prefix is by typing:

ip -4 addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet brd scope global eth0

The value in red above is the information you need. You can then remove that from your active network connections by typing this (Note: This is where your connection will drop if you are using SSH through IPv4):

ip addr del dev eth0

Make sure that you change the red portion to reflect your own IPv4/CIDR values that you discovered in the last command.

Disabling IPv4 Permanently on CentOS and Fedora

To disable IPv4 permanently, we will have to modify the files that build up the interfaces and generate the necessary files at boot.

Start by looking at the /etc/sysconfig/network file. If you enabled IPv6 after the Droplet was already created, you'll have to add a line here.

Open the file now:

sudo nano /etc/sysconfig/network

If it is not already there, add the line that tells the server to enable IPv6.


Next, you'll need to modify the /etc/sysconfig/network-scripts/ifcfg-eth0 file. This specifies how the network should be configured when it is brought up:

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

First, you'll want to comment out the IPv4 information so that this is not taken into account at boot:


Next, if you enabled IPv6 after the Droplet was already created, you'll need to add your IPv6 information. You should add the following lines or make sure they are set correctly:


Additionally, you'll need to adjust the DNS directives so that they mainly point to IPv6 name servers. Once again, this will be something you'll have to adjust if you enabled IPv6 after creation:


Save and close the file when you are finished.

If you need to disable IPv4 right now, you can follow the steps outlined in the section on temporarily disabling IPv4. Otherwise, IPv4 will be disabled at next boot.

Disabling IPv4 Permanently on Debian and Ubuntu

On a Debian or Ubuntu machine, you will have to modify files in a similar way. The file you are looking for is called /etc/network/interfaces.

Open this file with root privileges with your text editor:

sudo nano /etc/network/interfaces

If you enabled IPv6 upon creation, you will see both of these sections (and maybe more if you also enabled private networking):

iface eth0 inet6 static
    . . .
iface eth0 inet static
    . . .

To make sure that the IPv4 interface doesn't come back up on a reboot, delete or comment out the inet section for eth0 so that only the inet6 section is defined for eth0:

iface eth0 inet6 static
    . . .
#iface eth0 inet static
    #. . .

If you enabled IPv6 after the Droplet's creation by clicking the "Enable IPv6" button, you will need to delete or comment out the inet portion of the eth0 configuration just like above.

However, you'll also need to add the IPv6 section to your configuration. Add the following details to configure IPv6:

iface eth0 inet6 static
    address public_ipv6_address
    netmask 64
    gateway public_ipv6_gateway
    autoconf 0
    dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888

Save and close the file when you are finished.

If you need to disable IPv4 right now, you can go through the steps in the section on temporarily disabling IPv4. Otherwise, IPv4 will be disabled at next boot.


You should now have a Droplet that is only available through its IPv6 addresses. This might make certain procedures more difficult, but it can also be useful in certain circumstances. You can easily reverse this by reversing the steps you took in this guide.

To find out how to add additional IPv6 addresses to your Droplet, click here. For more information about using tools and configuring applications to work with IPv6, check out this link.


Creative Commons License