enable dhcp for internet

This commit is contained in:
2026-04-24 14:28:20 -05:00
parent 9ea854565d
commit 909b25c217
3 changed files with 212 additions and 44 deletions
+51 -44
View File
@@ -11,36 +11,33 @@ in
../../nixos
../../../users/blake
../../../modules/system
../../../modules/holocron
../../../modules/homelab
#../../../modules/holocron
#../../../modules/homelab
];
home-manager.users.blake.imports = [
../../../users/blake/hosts/vaniville.nix
];
modules = {
system = {
tailscale.enable = true;
ssh.enable = true;
};
system = {
tailscale.enable = true;
};
# use the systemd-boot EFI boot loader.
#boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.forceInstall = true;
# setup hostname and networking stack
networking = {
hostName = "vaniville"; # Define your hostname.
usePredictableInterfaceNames = false;
useDHCP = false;
#networkmanager.enable = true; # Easiest to use and most distros use this by default.
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
forceInstall = true;
};
};
};
# define shell
programs.zsh.enable = true;
@@ -59,36 +56,46 @@ in
# enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nat = {
enable = true;
externalInterface = "eth0"; # your PUBLIC_IF
internalInterfaces = [ "tailscale0" ];
forwardPorts = [
{ sourcePort = 80; destination = "10.10.0.10:80"; proto = "tcp"; } # http
{ sourcePort = 443; destination = "10.10.0.10:443"; proto = "tcp"; } # https
{ sourcePort = 25777; destination = "10.10.0.10:25777"; proto = "tcp"; } # minecraft
{ sourcePort = 25777; destination = "10.10.0.10:25777"; proto = "udp"; } # minecraft
{ sourcePort = 7567; destination = "10.10.0.10:7567"; proto = "tcp"; } # git
# setup hostname and networking stack
networking = {
hostName = "vaniville"; # Define your hostname.
usePredictableInterfaceNames = false;
useDHCP = false;
interfaces.eth0.useDHCP = true;
#networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Rustdesk ports
{ sourcePort = 21115; destination = "10.10.0.10:21115"; proto = "tcp"; }
{ sourcePort = 21116; destination = "10.10.0.10:21116"; proto = "tcp"; }
{ sourcePort = 21116; destination = "10.10.0.10:21116"; proto = "udp"; }
{ sourcePort = 21118; destination = "10.10.0.10:21118"; proto = "tcp"; }
{ sourcePort = 21117; destination = "10.10.0.10:21117"; proto = "tcp"; }
{ sourcePort = 21119; destination = "10.10.0.10:21119"; proto = "tcp"; }
];
nat = {
enable = true;
externalInterface = "eth0"; # your PUBLIC_IF
internalInterfaces = [ "tailscale0" ];
forwardPorts = [
{ sourcePort = 80; destination = "10.10.0.10:80"; proto = "tcp"; } # http
{ sourcePort = 443; destination = "10.10.0.10:443"; proto = "tcp"; } # https
{ sourcePort = 25777; destination = "10.10.0.10:25777"; proto = "tcp"; } # minecraft
{ sourcePort = 25777; destination = "10.10.0.10:25777"; proto = "udp"; } # minecraft
{ sourcePort = 7567; destination = "10.10.0.10:7567"; proto = "tcp"; } # git
# Rustdesk ports
{ sourcePort = 21115; destination = "10.10.0.10:21115"; proto = "tcp"; }
{ sourcePort = 21116; destination = "10.10.0.10:21116"; proto = "tcp"; }
{ sourcePort = 21116; destination = "10.10.0.10:21116"; proto = "udp"; }
{ sourcePort = 21118; destination = "10.10.0.10:21118"; proto = "tcp"; }
{ sourcePort = 21117; destination = "10.10.0.10:21117"; proto = "tcp"; }
{ sourcePort = 21119; destination = "10.10.0.10:21119"; proto = "tcp"; }
];
};
firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 25777 7567 21115 21116 21117 21118 21119 ];
# tailscale will also need its UDP port open:
allowedUDPPorts = [ config.services.tailscale.port 25777 21116 ];
trustedInterfaces = [ "tailscale0" ];
};
};
firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 25777 7567 21115 21116 21117 21118 21119 ];
# tailscale will also need its UDP port open:
allowedUDPPorts = [ config.services.tailscale.port 25777 21116 ];
trustedInterfaces = [ "tailscale0" ];
};
# Open ports in the firewall, the wrong way
# networking.firewall.enable = true;
# networking.firewall.extraCommands = ''