44 lines
1.3 KiB
Nix
44 lines
1.3 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
# Hostname
|
|
networking.hostName = "numbus-server";
|
|
|
|
networking.wireless.enable = false;
|
|
networking.networkmanager.enable = false;
|
|
|
|
networking.nftables.enable = true;
|
|
networking.firewall.enable = true;
|
|
|
|
# Bridge configuration for VMs
|
|
networking.bridges.br0.interfaces = [ "TARGET_INTERFACE" ];
|
|
networking.interfaces.br0.useDHCP = false;
|
|
networking.nameservers = [ "HOME_SERVER_IP" "9.9.9.9" ];
|
|
networking.interfaces.br0.ipv4.addresses = [{
|
|
address = "HOME_SERVER_IP";
|
|
prefixLength = 24;
|
|
}];
|
|
networking.defaultGateway = {
|
|
address = "HOME_ROUTER_IP";
|
|
interface = "br0";
|
|
};
|
|
|
|
networking.nftables.tables.nat = {
|
|
family = "ip";
|
|
content = ''
|
|
chain prerouting {
|
|
type nat hook prerouting priority dstnat; policy accept;
|
|
iifname "br0" tcp dport 80 redirect to :8080
|
|
iifname "br0" tcp dport 443 redirect to :8443
|
|
iifname "br0" tcp dport 53 redirect to :5353
|
|
iifname "br0" udp dport 53 redirect to :5353
|
|
iifname "br0" udp dport 67 redirect to :6767
|
|
}
|
|
'';
|
|
};
|
|
|
|
# Open ports in the firewall
|
|
networking.firewall.allowPing = true;
|
|
networking.firewall.allowedTCPPorts = [ 5353 8080 8443 ];
|
|
networking.firewall.allowedUDPPorts = [ 5353 6767 ];
|
|
} |