If your ISP supports IPv6 and assigns the IP address of your eth0
interface via DHCPv6 you may also be able to obtain one or more additional IPv6 prefixes. These prefixes can be used for other interfaces eth1
or eth2
but also for any virtual interfaces such as docker0, virbr0
and podman0
used for containers or VM’s running on your system.
In NetworkManager, find the connections you are interested in:
1 2 3 4 5 |
$ nmcli connection show NAME UUID TYPE DEVICE cni-podman0 1cf393c0-f1b1-4335-835f-e1939eebe789 bridge cni-podman0 eth0 b5f59873-5bd2-c5a6-acb6-f03d5581aca5 ethernet eth0 $ |
Ensure that the interface to your ISP is set to use dhcpv6:
1 2 3 |
$ nmcli connection show eth0 | grep ipv6.method ipv6.method: dhcp $ |
If not, modify it to use dhcp
1 |
$ nmcli connection modify eth0 ipv6.method "dhcp" |
Now you need to tell NetworkManager which interface to assign the delegated prefix from your ISP. Sadly NetworkManager will only ask for one prefix to be delegated. As a result, only one device can be told use it. Here, the podman cni bridge “cni-podman0” is setup to have the delegated prefix assigned to it.
1 |
nmcli connection modify cni-podman0 ipv6.method "shared" |
The magic in Linux which allows this to work are the sysctl values related to IPv6 SLAAC. By default, IPv6 is intended to auto-configure itself on all interfaces:
1 2 3 4 5 |
$ sysctl net.ipv6.conf.all.autoconf net.ipv6.conf.all.autoconf = 1 $ sysctl net.ipv6.conf.cni-podman0.autoconf net.ipv6.conf.cni-podman0.autoconf = 1 $ |
Now add containers created via podman that run on the “cni-podman0” bridge will obtain IPv6 prefxies which your ISP will recognize.