rename and fix
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.syscfg.server;
|
||||
in{
|
||||
in {
|
||||
config = mkIf (cfg.ipfw.enable) {
|
||||
boot.kernel.sysctl = {
|
||||
"net.ipv4.ip_forward" = 1;
|
||||
"net.ipv6.conf.all.forwarding" = 1;
|
||||
@@ -9,7 +10,6 @@ in{
|
||||
|
||||
networking.nftables.enable = true;
|
||||
networking.nftables.ruleset = ''
|
||||
${if cfg.nftables.enable then ''
|
||||
table inet nat {
|
||||
chain prerouting {
|
||||
type nat hook prerouting priority dstnat; policy accept;
|
||||
@@ -28,13 +28,14 @@ in{
|
||||
iifname "${srcInt}" tcp dport ${srcPort} counter dnat ip6 to [${dstAddr6}]:${dstPort}
|
||||
iifname "${srcInt}" udp dport ${srcPort} counter dnat ip6 to [${dstAddr6}]:${dstPort}
|
||||
''
|
||||
) config.syscfg.server.nftables.ports}
|
||||
) cfg.ipfw.ports}
|
||||
}
|
||||
|
||||
chain postrouting {
|
||||
type nat hook postrouting priority srcnat; policy accept;
|
||||
oifname { ${lib.concatMapStringsSep ", " (iface: ''"${iface}"'') config.syscfg.server.nftables.ifs} } masquerade
|
||||
oifname { ${lib.concatMapStringsSep ", " (iface: ''"${iface}"'') cfg.ipfw.ifs} } masquerade
|
||||
}
|
||||
}'' else ""}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user