T.: We’ve verified the system we’re running on generally has working IPv6. However, IPv6 internet access from within the mailcow containers doesn’t work initially (neither outbound (tested w ping and traceroute (doesn’t get past first hop, DNS resolution works tho) nor inbound (tested w curl and nc from external machine, but curling over IPv6 using the public address from local machine does work, so it’s not a socket binding issue)), it only works after restarting all containers. Kinda suspecting the Docker/mailcow-configured firewall (more on that in a moment), but just restarting the netfilter container ain’t enough for making’t work, we gotta do the full docker compose down and then docker compose up.
Reason y we think it’s a firewall issue: There’s a big difference between the iptables rules before and after restarting stuff, especially looking at how at first, there’s several references to docker0 before the restart that that after the restart seem’a be changed to br-mailcow.
root@mailcow:~/ > ip6tables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
707 223K MAILCOW all -- any any anywhere anywhere /* mailcow */
719 224K nixos-fw all -- any any anywhere anywhere
Chain FORWARD (policy DROP 203 packets, 17881 bytes)
pkts bytes target prot opt in out source destination
203 17881 MAILCOW all -- any any anywhere anywhere /* mailcow */
203 17881 DOCKER-USER all -- any any anywhere anywhere
203 17881 DOCKER-FORWARD all -- any any anywhere anywhere
0 0 REJECT all -- wg0 ens4 anywhere anywhere reject-with icmp6-port-unreachable
0 0 REJECT all -- wg0 lo anywhere anywhere reject-with icmp6-port-unreachable
0 0 REJECT all -- ens4 any anywhere anywhere reject-with icmp6-port-unreachable
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::12 tcp dpt:https
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::12 tcp dpt:http
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::11 tcp dpt:urd
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::11 tcp dpt:smtp
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::2 tcp dpt:imaps
0 0 DROP all -- !docker0 docker0 anywhere anywhere
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER all -- any docker0 anywhere anywhere
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any docker0 anywhere anywhere ctstate RELATED,ESTABLISHED
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
203 17881 DOCKER-CT all -- any any anywhere anywhere
203 17881 DOCKER-ISOLATION-STAGE-1 all -- any any anywhere anywhere
203 17881 DOCKER-BRIDGE all -- any any anywhere anywhere
0 0 ACCEPT all -- docker0 any anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER-ISOLATION-STAGE-2 all -- docker0 !docker0 anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any docker0 anywhere anywhere
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (2 references)
pkts bytes target prot opt in out source destination
Chain nixos-fw (1 references)
pkts bytes target prot opt in out source destination
0 0 nixos-fw-accept all -- lo any anywhere anywhere
411 197K nixos-fw-accept all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 nixos-fw-accept tcp -- any any anywhere anywhere tcp dpt:ssh
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:smtp
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:http
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:https
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:urd
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:imaps
0 0 nixos-fw-accept udp -- any any anywhere anywhere udp dpts:60000:61000
0 0 DROP ipv6-icmp -- any any anywhere anywhere ipv6-icmp redirect
0 0 DROP ipv6-icmp -- any any anywhere anywhere ipv6-icmptype 139
157 10056 nixos-fw-accept ipv6-icmp -- any any anywhere anywhere
0 0 nixos-fw-accept udp -- any any anywhere fe80::/64 udp dpt:dhcpv6-client
151 17058 nixos-fw-log-refuse all -- any any anywhere anywhere
Chain nixos-fw-accept (11 references)
pkts bytes target prot opt in out source destination
568 207K ACCEPT all -- any any anywhere anywhere
Chain nixos-fw-log-refuse (1 references)
pkts bytes target prot opt in out source destination
1 64 LOG tcp -- any any anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN LOG level info prefix "refused connection: "
150 16994 nixos-fw-refuse all -- any any anywhere anywhere PKTTYPE != unicast
1 64 nixos-fw-refuse all -- any any anywhere anywhere
Chain nixos-fw-refuse (2 references)
pkts bytes target prot opt in out source destination
151 17058 DROP all -- any any anywhere anywhere
root@mailcow:~/ > systemctl restart mailcow
root@mailcow:~/ > ip6tables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
927 393K MAILCOW all -- any any anywhere anywhere /* mailcow */
2790 2037K nixos-fw all -- any any anywhere anywhere
Chain FORWARD (policy DROP 219 packets, 19306 bytes)
pkts bytes target prot opt in out source destination
308 88030 MAILCOW all -- any any anywhere anywhere /* mailcow */
527 107K DOCKER-USER all -- any any anywhere anywhere
527 107K DOCKER-FORWARD all -- any any anywhere anywhere
0 0 REJECT all -- wg0 ens4 anywhere anywhere reject-with icmp6-port-unreachable
0 0 REJECT all -- wg0 lo anywhere anywhere reject-with icmp6-port-unreachable
0 0 REJECT all -- ens4 any anywhere anywhere reject-with icmp6-port-unreachable
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::10 tcp dpt:urd
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::10 tcp dpt:smtp
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::e tcp dpt:https
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::e tcp dpt:http
0 0 ACCEPT tcp -- !br-mailcow br-mailcow anywhere fd4d:6169:6c63:6f77::9 tcp dpt:imaps
0 0 DROP all -- !br-mailcow br-mailcow anywhere anywhere
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER all -- any br-mailcow anywhere anywhere
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
151 73414 ACCEPT all -- any br-mailcow anywhere anywhere ctstate RELATED,ESTABLISHED
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
527 107K DOCKER-CT all -- any any anywhere anywhere
376 33922 DOCKER-ISOLATION-STAGE-1 all -- any any anywhere anywhere
376 33922 DOCKER-BRIDGE all -- any any anywhere anywhere
157 14616 ACCEPT all -- br-mailcow any anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
pkts bytes target prot opt in out source destination
157 14616 DOCKER-ISOLATION-STAGE-2 all -- br-mailcow !br-mailcow anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any br-mailcow anywhere anywhere
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (2 references)
pkts bytes target prot opt in out source destination
Chain nixos-fw (1 references)
pkts bytes target prot opt in out source destination
19 1596 nixos-fw-accept all -- lo any anywhere anywhere
2025 1968K nixos-fw-accept all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 nixos-fw-accept tcp -- any any anywhere anywhere tcp dpt:ssh
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:smtp
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:http
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:https
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:urd
0 0 nixos-fw-accept tcp -- wg0 any anywhere anywhere tcp dpt:imaps
0 0 nixos-fw-accept udp -- any any anywhere anywhere udp dpts:60000:61000
0 0 DROP ipv6-icmp -- any any anywhere anywhere ipv6-icmp redirect
0 0 DROP ipv6-icmp -- any any anywhere anywhere ipv6-icmptype 139
366 23232 nixos-fw-accept ipv6-icmp -- any any anywhere anywhere
0 0 nixos-fw-accept udp -- any any anywhere fe80::/64 udp dpt:dhcpv6-client
380 44594 nixos-fw-log-refuse all -- any any anywhere anywhere
Chain nixos-fw-accept (11 references)
pkts bytes target prot opt in out source destination
2410 1992K ACCEPT all -- any any anywhere anywhere
Chain nixos-fw-log-refuse (1 references)
pkts bytes target prot opt in out source destination
12 928 LOG tcp -- any any anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN LOG level info prefix "refused connection: "
368 43666 nixos-fw-refuse all -- any any anywhere anywhere PKTTYPE != unicast
12 928 nixos-fw-refuse all -- any any anywhere anywhere
Chain nixos-fw-refuse (2 references)
pkts bytes target prot opt in out source destination
380 44594 DROP all -- any any anywhere anywhere