devices.vps4: add forward table

This commit is contained in:
2025-06-04 20:06:08 +08:00
parent 627f9cf9a8
commit 2c3687b785

View File

@@ -31,5 +31,24 @@ inputs:
xray.server.serverName = "xserver.vps4.chn.moe";
};
};
networking.nftables.tables.forward =
{
family = "inet";
content = let srv2 = inputs.topInputs.self.config.dns."chn.moe".getAddress "wg1.srv2-node0"; in
''
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 7011 fib daddr type local counter meta mark set meta mark | 4 dnat ip to ${srv2}:22
}
chain output {
type nat hook output priority dstnat; policy accept;
tcp dport 7011 fib daddr type local counter meta mark set meta mark | 4 dnat ip to ${srv2}:22
}
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
oifname wg1 meta mark & 4 == 4 counter masquerade
}
'';
};
};
}