I’m a software developer who runs Scribophile, an online writing group for serious writers, Writerfolio, an online writing portfolio service for freelancers, and Standard Ebooks, an open source project that produces liberated ebooks for the true book lover.

Adding an additional IPv6 address to a Digital Ocean droplet running Ubuntu 14.04

Recently I found myself needing to add an additional IPv6 address to a Digital Ocean droplet. The droplet was a run-of-the-mill Ubuntu 14.04 server installation.

Digital Ocean has a handy guide on how to add additional IPv6 addresses to droplets, where it instructs you to edit /etc/network/interfaces in order to have your additional IPv6 address persist across reboots. I followed it to the letter, and after I rebooting the server I found that yes, the additional IPv6 address had persisted. But to my dismay, I also found that the server had also become unable to resolve domains at all. Even something as simple as ping google.com failed because the server was unable to resolve google.com to an IP address.

After digging around a little, I discovered the problem: /etc/resolv.conf, the file that tells the server how to resolve domain names, was empty!

Now debugging complex network problems isn’t my specialty, but it was obvious that the incantation DO recommended for /etc/network/interfaces caused the system to incorrectly set up DNS resolution on boot. Since I was short on time, I didn’t feel like exploring why this occured, only how to fix it.

After scouring the net a little, I found the correct incantation for /etc/network/interfaces. For those of you who need to add an additional IPv6 address that persists across reboot, examine /etc/network/interfaces, where you’ll find a block that looks like this:

iface eth0 inet6 static address <your-ipv6-address> netmask 64 gateway <your-gateway-ipv6-address> autoconf 0 dns-nameservers <your-nameservers>

Add an additional line to that block, so that it looks like this:

iface eth0 inet6 static address <your-ipv6-address> netmask 64 gateway <your-gateway-ipv6-address> autoconf 0 dns-nameservers <your-nameservers> post-up ip -6 addr add <your-additional-ipv6-address>/64 dev eth0

Reboot your server to activate the additional IPv6 address. There’s no need to do anything else recommended in the DO article.