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

45 lines
1.1 KiB
Nix

{ ... }:
{
networking = {
interfaces."enp0s31f6".ipv4.addresses = [{
address = "10.2.0.1";
prefixLength = 8;
}];
defaultGateway = {
address = "10.1.0.1";
interface = "enp0s31f6";
};
vlans.internal = {
id=100;
interface="enp0s31f6";
};
interfaces.internal.ipv4.addresses = [{
address = "11.0.0.1";
prefixLength = 8;
}];
nftables.tables.forwarding = {
family = "inet";
content = ''
chain incoming {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat ip to 11.0.0.100:22 comment "Tower SSH"
tcp dport 2222 dnat ip to 11.0.0.2:22 comment "Kitty SSH"
tcp dport 2050 dnat ip to 11.0.0.2:2049 comment "Kitty NFS"
udp dport { 27005, 27015 } dnat ip to 11.0.0.100 comment "PC Hosted Games"
}
chain forward {
type nat hook postrouting priority 100; policy accept;
masquerade
}
'';
};
};
# Enable IP forwarding for the server configuration
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
}