Tuesday, February 17, 2015

Docker 1.5 and IPv6 on Ubuntu

Docker 1.5 offers IPv6. Here's how I got it working on my Ubuntu VPS.

First of all: my VPS provider (thanks, Philip!) was so friendly to provide & route a separate IPv6 subnet to my VPS, which I used for Docker:

  • Separate subnet provided by my VPS provider: 2001:AAAA:FF00:1700::/56
  • Sub-subnet used for Docker: 2001:AAAA:FF00:1700::/64 


(Note: AAAA is a placeholder for the real hex digits)

First check you have at least docker 1.5:

sander@makreel:~$ sudo docker --version
Docker version 1.5.0, build 7e803ba

Stop de docker daemon:

sudo service docker stop

To avoid

FATA[0000] bridge IPv6 does not match existing bridge configuration fe80::1

do this:

sudo apt-get install bridge-utils
sudo ifconfig docker0 down
sudo brctl delbr docker0

Then start the docker daemon with IPv6 and the IPv6 subnet:

sudo docker -d --ipv6 --fixed-cidr-v6="2001:AAAA:FF00:1700::/64"

And that's it! The docker daemon is ready, and you don't need any special settings in the docker container. Let's check that:

Check IPv6 within a ubuntu container:

sander@makreel:~$ sudo docker run -it ubuntu bash -c "ifconfig"
eth0      Link encap:Ethernet  HWaddr 02:42:ac:11:00:0a
          inet addr:172.17.0.10  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:acff:fe11:a/64 Scope:Link
          inet6 addr: 2001:aaaa:ff00:1700:0:242:ac11:a/64 Scope:Global
          UP BROADCAST  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:110 (110.0 B)  TX bytes:90 (90.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Looks good. 
Check you have outside IPv6 connectivity

sander@makreel:~$ sudo docker run -it ubuntu bash -c "ping6 -c5 ipv6.google.com"
PING ipv6.google.com(2a00:1450:400c:c07::64) 56 data bytes
64 bytes from 2a00:1450:400c:c07::64: icmp_seq=3 ttl=56 time=7.12 ms
64 bytes from 2a00:1450:400c:c07::64: icmp_seq=4 ttl=56 time=7.05 ms
64 bytes from 2a00:1450:400c:c07::64: icmp_seq=5 ttl=56 time=7.28 ms

--- ipv6.google.com ping statistics ---
5 packets transmitted, 3 received, 40% packet loss, time 4019ms
rtt min/avg/max/mdev = 7.056/7.152/7.280/0.116 ms
sander@makreel:~$

Good! So IPv6 is working!

Speedtest:


$ sudo docker run -it ubuntu bash -c "apt-get update && apt-get install -y wget && wget -6 'http://ftp.belnet.be/ubuntu.com/ubuntu/releases/precise/ubuntu-12.04.4-desktop-i386.iso' -O /dev/null"
...
100%[======================================>] 766,509,056 8.25MB/s   in 97s
2015-02-17 12:16:50 (7.52 MB/s) - '/dev/null' saved [766509056/766509056]
sander@makreel:~$



Note: the official documentation https://docs.docker.com/articles/networking/#ipv6-with-docker does not state you need a separate IPv6 subnet. Strange.




No comments: