From df06d3225d3a2bf70ac0bde207f4fe626f5d4a8a Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Tue, 12 May 2020 22:54:39 +0200 Subject: [PATCH] lan: new lan for essen --- configs/pepe/configuration.nix | 1 + configs/pepe/lan.nix | 26 ++++++++++++++++++++++++++ configs/workout/configuration.nix | 2 +- configs/workout/lan.nix | 26 ++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 configs/pepe/lan.nix create mode 100644 configs/workout/lan.nix diff --git a/configs/pepe/configuration.nix b/configs/pepe/configuration.nix index 5e9621b..ceb8cec 100644 --- a/configs/pepe/configuration.nix +++ b/configs/pepe/configuration.nix @@ -10,6 +10,7 @@ ./syncthing.nix ./tinc.nix ./wifi-access-point.nix + ./lan.nix ./dms.nix ]; diff --git a/configs/pepe/lan.nix b/configs/pepe/lan.nix new file mode 100644 index 0000000..c7877fd --- /dev/null +++ b/configs/pepe/lan.nix @@ -0,0 +1,26 @@ +{ lib, pkgs, ... }: +let + + interface = "enp0s25"; + ipAddress = "10.1.0.2"; + prefixLength = 24; + +in { + + networking.extraHosts = '' + 10.1.0.1 workout.lan + 10.1.0.2 pepe.lan + ''; + + # todo only open needed ports + networking.firewall.trustedInterfaces = [ interface ]; + + networking.networkmanager.unmanaged = [ interface ]; + networking.dhcpcd.denyInterfaces = [ interface ]; + + networking.interfaces."${interface}".ipv4.addresses = [{ + address = ipAddress; + prefixLength = prefixLength; + }]; + +} diff --git a/configs/workout/configuration.nix b/configs/workout/configuration.nix index 6524f92..385b570 100644 --- a/configs/workout/configuration.nix +++ b/configs/workout/configuration.nix @@ -9,7 +9,7 @@ #./slack.nix ./syncthing.nix ./tinc.nix - + ./lan.nix ]; networking.hostName = "workout"; diff --git a/configs/workout/lan.nix b/configs/workout/lan.nix new file mode 100644 index 0000000..04dcf3e --- /dev/null +++ b/configs/workout/lan.nix @@ -0,0 +1,26 @@ +{ lib, pkgs, ... }: +let + + interface = "eno1"; + ipAddress = "10.1.0.1"; + prefixLength = 24; + +in { + + networking.extraHosts = '' + 10.1.0.1 workout.lan + 10.1.0.2 pepe.lan + ''; + + # todo only open needed ports + networking.firewall.trustedInterfaces = [ interface ]; + + networking.networkmanager.unmanaged = [ interface ]; + networking.dhcpcd.denyInterfaces = [ interface ]; + + networking.interfaces."${interface}".ipv4.addresses = [{ + address = ipAddress; + prefixLength = prefixLength; + }]; + +}