NixOS Server IPv6 forwarding not working / not reachable

Hi, I have the following problem: I switched my local Minecraft server from Debian to NixOS. The MC server itself runs fine, and I can reach it via IPv4 and IPv6 on my local network. The SSL certificates from Let’s Encrypt and Nginx are also working on my local network, just like on the old Debian server. I port-forwarded the server on my router exactly as I did for my old server, but the server is not reachable from outside. (I only have an external IPv6 address because I’m behind a CG-NAT from my ISP). My old server is reachable without any problem, but my NixOS server is not. I don’t understand this behavior. Do you have any ideas about what I might have configured incorrectly? Here is my config:

networking = {
      networkmanager = {
        enable = true;
        dns = "default";
      };

      enableIPv6 = true;

      hostName = "NixOS-Server";

    interfaces = {  
      enp0s18 = {
        ipv4.addresses = [ {
          address = "10.75.0.22";
          prefixLength = 24;
        } ];
      };
    };

    useDHCP = false;
};

services.nginx = {
      virtualHosts = {
        "minecraft.mydomain.com" = {
          forceSSL = true;
          enableACME = true;
          acmeRoot = null;
          kTLS = true;
          http2 = false;
          locations."/" = { 
            proxyPass = "http://localhost:25565";
          };
        };
};

After some testing I also found out, that this behavior happens on every nixos installation. Also when I install a clean nixos with the installer and then install nginx or the mc server. It is reachable on my local network, but the portforwarding in my fritzbox does not work / is not reachable externaly.

Make sure to open ports in firewall:

networking.firewall.allowedTCPPorts = [
  80 # http
  443 # https
  25565 # minecraft
];

This actually sounds like an issue with your router configuration.

This wont work btw, nginx doesn’t support minecraft protocol.

Thank you so far. I disabled the firewall entirely, so this can not be the issue. And thanks, I missed removing the mc part from nginx.
But the problem still exists. And the wrong router configuration sounds possible, but I do not understand why it is not working on NixOS, but on other Linux distributions without an issue.

Mayber some error with my MC Server setup?

services.minecraft-server = {
      enable = true;
      eula = true;
      jvmOpts = "-Xmx8192M -Djava.net.preferIPV4stack=false -Djava.net.preferIPv6Addresses=true -Dlog4j2.formatMsgNoLookups=true";
      package = pkgs.minecraftServers.vanilla-1_20_6;
    };

Have you actually tried using different distribution besides your Debian server?
I suggest you use tcpdump to debug your issue.

Yes, I also tried a fresh Ubuntu install, put a mc server on it and prot forwarded the server. Was reachable without any issue about my ipv6.
Thanks, I will try tcpdump. Maybe I can figure it out.

Thank you so far. I tried using tcpdump. I can see the connection request in my local network. However, when I try to connect externally, nothing shows up in tcpdump. When I try to ping the server, I get the following error:

Destination unreachable: Port unreachable

Any other ideas, or could it be my router?

This just means the router is not passing packets to the NixOS machine or your tcpdump incantation is wrong. There’s not enough information to give useful advice