My brain-dump of random code/configuration.

19 Jan 2015

Ipv6 Configuration on Digitalocean on Freebsd

By default Digitalocean add some custom rc.d scripts for network configuration to your droplet.

You can just append the content of /etc/rc.digitalocean.d/droplet.conf to your /etc/rc.conf In my case the public ipv4 address is and my first ipv6 address is 2a03:b0c0:2:d0::2a5:f001.

# ipv6 address are shortened for readability
ifconfig_vtnet0="inet netmask"
ifconfig_vtnet0_ipv6="inet6 2a03:b0c0:2:d0::2a5:f001 prefixlen 64"

Digitalocean provides these days for native Ipv6 for the most of its datacenters. Unlike other hoster they are very spare, when distributing Ipv6 Addresses and only route 16 addresses per droplet (xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxx1 until xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxf). To make use of these additional ip addresses they have to be assigned to your network interface vtnet0:

                      inet6 2a03:b0c0:2:d0::2a5:f002 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f003 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f004 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f005 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f006 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f007 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f008 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f009 prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00a prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00b prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00c prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00d prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00e prefixlen 64 \
                      inet6 2a03:b0c0:2:d0::2a5:f00f prefixlen 64"

In case you want to add freebsd jails later on, it is a good idea to allocate private ipv4 addresses for these too. In my case I generated as many ipv4 address as ipv6 addresses I got:

cloned_interfaces="${cloned_interfaces} lo1"
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \
                      inet \

To apply these network settings immediately issue the following commands in series:

$ sudo service netif restart; sudo /etc/rc.d/routing restart

The second command is important because it adds the ipv4 gateway back. Otherwise you will not reach your droplet via ipv4 without rebooting.

If everything still works, you can remove, the following files leftover from cloudflare’s provisioning:

$ rm /etc/rc.d/digitalocean
$ rm -r /etc/rc.digitalocean.d
$ rm -r /usr/local/bsd-cloudinit/
$ pkg remove avahi-autoipd
comments powered by Disqus