OVH gives you a /128 block by default. But in fact you can use the whole /64. You can simply add a /64 address to eth0.
But if you activate IPv6 in docker and try to allocate an address in bridge network, you will find the address is not ping-able. The problem here is we should send a NDP notification to OVH router.
How it works
Configure docker to use IPv6
According to this docker document ,we should append these options to dockerd:
–ipv6 –fixed-cidr-v6=aaaa:bbbb:cccc:dddd:1::/80
If you are an Ubuntu user and upgrade from 14.04 to 16.04, you may be thinking to edit /etc/default/docker. But actually systemd will not read this file at all. Systemd is never wrong. So you may either add these lines to /lib/systemd/system/docker.service:
1 2 |
EnvironmentFile=-/etc/default/docker ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS |
or create /etc/docker/daemon.json and put:
1 2 3 4 |
{ "ipv6": true, "fixed-cidr-v6": "aaaa:bbbb:cccc:dddd:1::/80" } |
The latter is recommended.
Configure kernel to forward IPv6
According to docker document,run:
1 2 |
sysctl net.ipv6.conf.default.forwarding=1 sysctl net.ipv6.conf.all.forwarding=1 |
OVH does not use Router Advertisement to allocate IPv6, so we don’t need to touch net.ipv6.conf.eth0.accept_ra.
Configure kernel to proxy NDP
This is needed to tell the OVH router that please let me handle the packet with source or destination equal to this address. Run:
1 |
sysctl net.ipv6.conf.eth0.proxy_ndp=1 |
Then set to proxy NDP, the IPv6 address should be container’s IPv6 address.
1 |
ip -6 neigh add proxy aaaa:bbbb:cccc:dddd:1::xxxx dev eth0 |
You may find this annoying to set this every time for a new container. So you can:
- Set ndp proxy for aaaa:bbbb:cccc:dddd:1:242:ac11:0 – aaaa:bbbb:cccc:dddd:1:242:ac11:ffff in advance. That’s because docker uses MAC address to configure IPv6 by default, according to this document, docker will only use 02:42:ac:11:00:00 to 02:42:ac:11:ff:ff as MAC address for container.
- Install ndppd,create and edit /etc/ndppd.conf:
proxy eth0 {
rule aaaa:bbbb:cccc:dddd:1::/80 {}
}