upstream: fix masquerading

This commit is contained in:
Sandro - 2024-04-11 23:58:09 +02:00
parent a2f7356c53
commit 611ac377be
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 11 additions and 1 deletions

View File

@ -103,7 +103,17 @@ in
-d ${staticIpv4Address} -p ${fwd.proto} \
--dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination}
'') config.networking.nat.forwardPorts}
iptables -t nat -A nixos-nat-post \
-d ${fwd.destination} -p ${fwd.proto} \
--dport ${builtins.toString fwd.destination} \
-s ${config.site.net.core.subnet4} -j MASQUERADE
iptables -t nat -A nixos-nat-post \
-d ${fwd.destination} -p ${fwd.proto} \
--dport ${builtins.toString fwd.destination} \
-s ${config.site.net.c3d2.subnets4} -j MASQUERADE
'') config.networking.nat.forwardPorts}
''}
# Do not NAT our public IPv4 addresses