Über die Weihnachtsferien wollte ich mal mein Homelab setup etwas anpassen und endlich IPv6+Docker zum laufen kriegen. Nach 3 Tagen rumprobieren gehen mir allerdings langsam die Ideen aus, was hier schief laufen könnte.
Docker mal ausgeschlossen sieht mein Setup folgendermaßen aus:
(/etc/systemd/network/89-ethernet.network)
[Match]
Name=enp10s0
[Link]
RequiredForOnline=routable
[Network]
DHCP=no
IPv6AcceptRA=no # disable automatic ip assignment
IPForward=yes # https://wiki.archlinux.org/title/Docker#Troubleshooting
Address=192.168.178.11/24
Address=<ULA-Prefix>::0011/64
Gateway=192.168.178.1
Gateway=<ULA-Prefix>::<Gateway-Suffix>
DNS=1.1.1.1
DNS=8.8.8.8
DNS=2606:4700:4700::1111
DNS=2001:4860:4860::8888
$> networkctl list
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 enp11s0 ether off unmanaged
3 enp10s0 ether routable configured
$> iptables -S (selber output für ip6tables)
-P INPUT DROP
-P FORWARD DROP
-P OUTPUT ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -j DROP
Mit diesem Setup habe ich netzwerkverbindung sowohl für IPv4 als auch IPv6 und sowohl ping -6 ... als auch curl -6 ... liefern sinnvolle ergebnisse. Sobald ich docker starte, funktioniert IPv6 allerdings nicht mehr. Weder auf dem host noch in den Containern sind IPv6 addressen reachable.
Wie auf der arch-wiki seite zu docker beschrieben, habe ich eine post-routing direktive hinzugefügt:
(/etc/iptables/ip6tables.rules)
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [62:14340]
# acceptable connections
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
# http/https
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
# ssh
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
# fall-through -> drop
-A INPUT -j DROP
COMMIT
*nat
:PREROUTING ACCEPT [38:2984]
:INPUT ACCEPT [38:2984]
:OUTPUT ACCEPT [106:8484]
:POSTROUTING ACCEPT [106:8484]
-A POSTROUTING -s fd00::/80 ! -o docker0 -j MASQUERADE # <----------
COMMIT
Und die daemon.json datei angepasst:
(/etc/docker/daemon.json)
{
"data-root": "/storage/docker-data",
"storage-driver": "zfs",
"fixed-cidr-v6": "fd00::/80",
"ipv6": true,
"ip6tables": true,
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"args": [],
"path": "nvidia-container-runtime"
}
}
}
Ich habe bereits jegliche kombinationen vom ipv6 und ip6tables attribut ausprobiert aber egal was ich auf true oder false setze, ich schaffe es nicht mehr eine IPv6 verbindung auf dem host hinzukriegen. Eigentlich möchte ich natürlich IPv6 connectivity sowohl auf dem host als auch in den containern, aber wenn ich beides auf true setze laufe ich in die folgenden fehler:
$> docker run --rm curlimages/curl curl -v -6 archlinux.org
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Host archlinux.org:80 was resolved.
* IPv6: 2a01:4f9:c013:e0e4::1
* IPv4: (none)
* Trying [2a01:4f9:c013:e0e4::1]:80...
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0* connect to 2a01:4f9:c013:e0e4::1 port 80 from fd00::2 port 54446 failed: Host is unreachable
* Failed to connect to archlinux.org port 80 after 3047 ms: Could not connect to server
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
* closing connection #0
curl: (7) Failed to connect to archlinux.org port 80 after 3047 ms: Could not connect to server
$> ping -6 -c 3 -v 2606:4700:4700::1111
ping: sock4.fd: -1 (socktype: 0), sock6.fd: 3 (socktype: SOCK_DGRAM), hints.ai_family: AF_INET6
ping: ai->ai_family: AF_INET6, ai->ai_canonname: '2606:4700:4700::1111'
PING 2606:4700:4700::1111 (2606:4700:4700::1111) 56 data bytes
From fd61:dc22:e19f::11 icmp_seq=1 Destination unreachable: Address unreachable
From fd61:dc22:e19f::11 icmp_seq=2 Destination unreachable: Address unreachable
From fd61:dc22:e19f::11 icmp_seq=3 Destination unreachable: Address unreachable
--- 2606:4700:4700::1111 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2023ms
Wenn ich meine eigenen iptables und ip6tables rules weglasse und die empty.rules lade, bevor ich docker starte, gibt es das gleiche ergebnis (mit dem kleinen unterschied, dass das curl im container nicht direkt in nen host-unreachable fehler läuft, sondern etwas länger auf nen Netzwerk timeout wartet).
Mir gehen leider die Ideen aus, was hier schieflaufen könnte und würde mich über jeden vorschlag eurerseits freuen.