haccfiles/parsons/nftables.nix

30 lines
754 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
{
networking.firewall.enable = true;
networking.nat.enable = false;
2024-02-25 16:53:54 +00:00
boot = {
kernelModules = [ "nf_nat_ftp" ];
kernel.sysctl = {
"net.ipv4.conf.all.forwarding" = true;
"net.ipv4.conf.default.forwarding" = true;
};
2024-02-25 16:53:54 +00:00
};
networking.nftables.enable = true;
networking.nftables.tables.nat = {
family = "ip";
content = ''
chain prerouting {
type nat hook prerouting priority -100
iifname enp35s0 tcp dport { 22 } dnat ${config.containers.forgejo.localAddress}:22
2024-02-25 16:53:54 +00:00
}
chain postrouting {
type nat hook postrouting priority 100
iifname lxcbr0 oifname enp35s0 masquerade
iifname ve-* oifname enp35s0 masquerade
2024-02-25 16:53:54 +00:00
}
'';
};
}