37 lines
987 B
Nix
37 lines
987 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
# Hostname
|
|
networking.hostName = "numbus-server";
|
|
|
|
# Enable networking and firewall
|
|
networking.interfaces.eth0.ipv4.addresses = [
|
|
{
|
|
address = "HOME_SERVER_IP";
|
|
prefixLength = 24;
|
|
}
|
|
];
|
|
networking.defaultGateway = "HOME_ROUTER_IP";
|
|
networking.nameservers = [ "HOME_SERVER_IP" "9.9.9.9" ];
|
|
networking.networkmanager.enable = true;
|
|
networking.nftables.enable = true;
|
|
networking.firewall.enable = true;
|
|
|
|
networking.nftables.tables.nat = {
|
|
family = "ip";
|
|
content = ''
|
|
chain prerouting {
|
|
type nat hook prerouting priority dstnat; policy accept;
|
|
tcp dport 80 redirect to :8080
|
|
tcp dport 443 redirect to :8443
|
|
tcp dport 53 redirect to :5353
|
|
udp dport 53 redirect to :5353
|
|
}
|
|
'';
|
|
};
|
|
|
|
# Open ports in the firewall
|
|
networking.firewall.allowPing = true;
|
|
networking.firewall.allowedTCPPorts = [ 53 80 443 ];
|
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
|
} |