nixos-config/hosts/midas/firewall/default.nix

30 lines
1.1 KiB
Nix

{ ... }:
{
networking.nftables.tables.forwarding = {
family = "inet";
content = ''
chain incoming {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat ip to 10.2.0.100:22 comment "SSH to Tower"
tcp dport 2222 dnat ip to 10.2.0.2:22 comment "SSH to Kitty"
tcp dport 2233 dnat ip to 10.2.0.101:22 comment "SSH to Intuos"
udp dport { 27005, 27015 } dnat ip to 10.2.0.100 comment "PC Hosted Games"
tcp dport { 48010, 47989, 47984 } dnat ip to 10.2.0.100 comment "PC Sunshine TCP"
udp dport { 47998, 47999, 48000 } dnat ip to 10.2.0.100 comment "PC Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat ip to 10.3.0.1 comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat ip to 10.3.0.1 comment "VM Sunshine UDP"
}
chain forward {
type nat hook postrouting priority 100; policy accept;
oifname "enp0s31f6" masquerade
}
'';
};
# Enable IP forwarding for the server configuration
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
}