aboutsummaryrefslogtreecommitdiff
path: root/nixos/machine
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-01-27 13:20:03 +0100
committerKarel Kočí <cynerd@email.cz>2024-01-27 13:20:03 +0100
commitc1a76b4403edcf5e2a147d68b7bbdf1c33ac95ef (patch)
tree95b00eb500c49c3358b3f736eae9cfe9165f354a /nixos/machine
parent6b0bc35f83a14ee9f9a34e1af782f1ef4c363d6e (diff)
downloadnixos-personal-c1a76b4403edcf5e2a147d68b7bbdf1c33ac95ef.tar.gz
nixos-personal-c1a76b4403edcf5e2a147d68b7bbdf1c33ac95ef.tar.bz2
nixos-personal-c1a76b4403edcf5e2a147d68b7bbdf1c33ac95ef.zip
Rework routers to use systemd-networkd
Diffstat (limited to 'nixos/machine')
-rw-r--r--nixos/machine/adm-omnia.nix68
-rw-r--r--nixos/machine/adm-omnia2.nix42
-rw-r--r--nixos/machine/spt-mox.nix43
-rw-r--r--nixos/machine/spt-mox2.nix52
-rw-r--r--nixos/machine/spt-omnia.nix67
-rw-r--r--nixos/machine/spt-omniax.nix57
6 files changed, 228 insertions, 101 deletions
diff --git a/nixos/machine/adm-omnia.nix b/nixos/machine/adm-omnia.nix
index fd6d654..088481f 100644
--- a/nixos/machine/adm-omnia.nix
+++ b/nixos/machine/adm-omnia.nix
@@ -9,7 +9,7 @@ with lib; {
cynerd = {
router = {
enable = true;
- wan = "end2"; # TODO pppoe-wan
+ wan = "pppoe-wan";
lanIP = config.cynerd.hosts.adm.omnia;
};
wifiAP.adm = {
@@ -21,8 +21,53 @@ with lib; {
monitoring.speedtest = true;
};
+ networking.useDHCP = false;
+ systemd.network = {
+ networks = {
+ "end2" = {
+ matchConfig.Name = "end2";
+ #networkConfig = {
+ # DHCP = "ipv6";
+ # IPv6AcceptRA = "yes";
+ # DHCPPrefixDelegation = "yes";
+ #};
+ #dhcpPrefixDelegationConfig = {
+ # UplinkInterface = ":self";
+ # SubnetId = 0;
+ # Announce = "no";
+ #};
+ linkConfig.RequiredForOnline = "routable";
+ };
+ "lan-brlan" = {
+ matchConfig.Name = "lan[1-4]";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
+ };
+ "lan0-guest" = {
+ matchConfig.Name = "lan0";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 2;
+ PVID = 2;
+ };
+ }
+ ];
+ };
+ };
+ };
+
services.pppd = {
- enable = false;
+ enable = true;
peers."wan".config = ''
plugin pppoe.so end2
ifname pppoe-wan
@@ -38,23 +83,6 @@ with lib; {
password 02
'';
};
- #systemd.services."pppd-wan".after = ["sys-subsystem-net-devices-end2.device"];
-
- environment.systemPackages = [pkgs.tcpdump];
-
- networking = {
- useNetworkd = true;
- useDHCP = false;
- };
- systemd.network.networks = {
- "lan-brlan" = {
- matchConfig.Name = "lan[1-4]";
- networkConfig.Bridge = "brlan";
- };
- "lan0-brguest" = {
- matchConfig.Name = "lan0";
- networkConfig.Bridge = "brguest";
- };
- };
+ systemd.services."pppd-wan".after = ["sys-subsystem-net-devices-end2.device"];
};
}
diff --git a/nixos/machine/adm-omnia2.nix b/nixos/machine/adm-omnia2.nix
index 7673ecf..31aecab 100644
--- a/nixos/machine/adm-omnia2.nix
+++ b/nixos/machine/adm-omnia2.nix
@@ -7,6 +7,11 @@
with lib; {
config = {
cynerd = {
+ switch = {
+ enable = true;
+ lanAddress = "${config.cynerd.hosts.adm.omnia2}/24";
+ lanGateway = config.cynerd.hosts.adm.omnia;
+ };
wifiAP.adm = {
enable = true;
ar9287.interface = "wlp2s0";
@@ -15,28 +20,23 @@ with lib; {
};
networking = {
- vlans = {
- "brlan.guest" = {
- interface = "brlan";
- id = 2; # TODO later use 100
- };
- };
- bridges = {
- brlan.interfaces = ["end2" "lan0" "lan1" "lan2" "lan3" "lan4"];
- brguest.interfaces = ["brlan.guest"];
+ useNetworkd = true;
+ useDHCP = false;
+ };
+ systemd.network.networks = {
+ "lan-brlan" = {
+ matchConfig.Name = "lan* eth0";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
};
- interfaces.brlan.ipv4.addresses = [
- {
- address = config.cynerd.hosts.adm.omnia2;
- prefixLength = 24;
- }
- ];
- defaultGateway = config.cynerd.hosts.adm.omnia;
- nameservers = ["1.1.1.1" "8.8.8.8"];
- dhcpcd.allowInterfaces = [];
};
-
- # TODO: ubootTools build is broken!
- firmware.environment.enable = false;
};
}
diff --git a/nixos/machine/spt-mox.nix b/nixos/machine/spt-mox.nix
index accd963..452b187 100644
--- a/nixos/machine/spt-mox.nix
+++ b/nixos/machine/spt-mox.nix
@@ -9,38 +9,39 @@ with lib; {
config = {
cynerd = {
home-assistant = true;
+ switch = {
+ enable = true;
+ lanAddress = "${config.cynerd.hosts.spt.mox}/24";
+ lanGateway = config.cynerd.hosts.spt.omnia;
+ };
wifiAP.spt = {
enable = true;
qca988x = {
interface = "wls1";
+ bssids = ["04:f0:21:24:24:d2" "08:f0:21:24:24:d2"];
channel = 7;
};
};
};
networking = {
- vlans = {
- "brlan.guest" = {
- id = 2;
- interface = "brlan";
- };
- };
- bridges = {
- brlan.interfaces = ["eth0" "lan1" "lan2" "lan3" "lan4"];
- brguest.interfaces = ["brlan.guest"];
+ useNetworkd = true;
+ useDHCP = false;
+ };
+ systemd.network.networks = {
+ "lan-brlan" = {
+ matchConfig.Name = "lan* end0";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
};
- interfaces.brlan.ipv4.addresses = [
- {
- address = config.cynerd.hosts.spt.mox;
- prefixLength = 24;
- }
- ];
- defaultGateway = config.cynerd.hosts.spt.omnia;
- nameservers = ["1.1.1.1" "8.8.8.8"];
- dhcpcd.allowInterfaces = [];
};
-
- # TODO: ubootTools build is broken!
- firmware.environment.enable = false;
};
}
diff --git a/nixos/machine/spt-mox2.nix b/nixos/machine/spt-mox2.nix
index 4d1a148..cf94798 100644
--- a/nixos/machine/spt-mox2.nix
+++ b/nixos/machine/spt-mox2.nix
@@ -7,45 +7,39 @@
with lib; {
config = {
cynerd = {
+ switch = {
+ enable = true;
+ lanAddress = "${config.cynerd.hosts.spt.mox2}/24";
+ lanGateway = config.cynerd.hosts.spt.omnia;
+ };
wifiAP.spt = {
enable = true;
qca988x = {
interface = "wls1";
- channel = 7;
+ bssids = ["04:f0:21:45:d3:47" "08:f0:21:45:d3:47"];
+ channel = 1;
};
};
};
- swapDevices = [
- {
- device = "/dev/disk/by-partlabel/NixTurrisSwap";
- priority = 1;
- }
- ];
-
networking = {
- vlans = {
- "brlan.guest" = {
- id = 2;
- interface = "brlan";
- };
- };
- bridges = {
- brlan.interfaces = ["eth0"];
- brguest.interfaces = ["brlan.guest"];
+ useNetworkd = true;
+ useDHCP = false;
+ };
+ systemd.network.networks = {
+ "lan-brlan" = {
+ matchConfig.Name = "end0";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
};
- interfaces.brlan.ipv4.addresses = [
- {
- address = config.cynerd.hosts.spt.mox2;
- prefixLength = 24;
- }
- ];
- defaultGateway = config.cynerd.hosts.spt.omnia;
- nameservers = ["1.1.1.1" "8.8.8.8"];
- dhcpcd.allowInterfaces = [];
};
-
- # TODO: ubootTools build is broken!
- firmware.environment.enable = false;
};
}
diff --git a/nixos/machine/spt-omnia.nix b/nixos/machine/spt-omnia.nix
index bf72a6e..15cabb6 100644
--- a/nixos/machine/spt-omnia.nix
+++ b/nixos/machine/spt-omnia.nix
@@ -14,18 +14,68 @@ with lib; {
};
wifiAP.spt = {
enable = true;
- ar9287.interface = "wlp3s0";
- qca988x.interface = "wlp2s0";
+ ar9287 = {
+ interface = "wlp3s0";
+ bssids = ["04:f0:21:23:16:64" "08:f0:21:23:16:64"];
+ channel = 13;
+ };
+ qca988x = {
+ interface = "wlp2s0";
+ bssids = ["04:f0:21:24:21:93" "08:f0:21:24:21:93"];
+ channel = 36;
+ };
};
openvpn.oldpersonal = true;
monitoring.speedtest = true;
};
- networking.vlans."end2.848" = {
- id = 848;
- interface = "end2";
+ networking.useDHCP = false;
+ systemd.network = {
+ netdevs = {
+ "end2.848" = {
+ netdevConfig = {
+ Kind = "vlan";
+ Name = "end2.848";
+ };
+ vlanConfig.Id = 848;
+ };
+ };
+ networks = {
+ "end2" = {
+ matchConfig.Name = "end2";
+ networkConfig.VLAN = ["end2.848"];
+ };
+ "end2.848" = {
+ matchConfig.Name = "end2.848";
+ networkConfig = {
+ BindCarrier = "end2";
+ #DHCP = "ipv6";
+ #IPv6AcceptRA = "yes";
+ #DHCPPrefixDelegation = "yes";
+ };
+ #dhcpPrefixDelegationConfig = {
+ # UplinkInterface = ":self";
+ # SubnetId = 0;
+ # Announce = "no";
+ #};
+ linkConfig.RequiredForOnline = "routable";
+ };
+ "lan-brlan" = {
+ matchConfig.Name = "lan*";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
+ };
+ };
};
- # TODO pppd service requires end2.848 interface
+
services.pppd = {
enable = true;
peers."wan".config = ''
@@ -43,10 +93,7 @@ with lib; {
password metronet
'';
};
-
- networking.bridges = {
- brlan.interfaces = ["lan0" "lan1" "lan2" "lan3" "lan4"];
- };
+ systemd.services."pppd-wan".after = ["sys-subsystem-net-devices-end2.848.device"];
services.syncthing = {
enable = true;
diff --git a/nixos/machine/spt-omniax.nix b/nixos/machine/spt-omniax.nix
new file mode 100644
index 0000000..9bdc3d3
--- /dev/null
+++ b/nixos/machine/spt-omniax.nix
@@ -0,0 +1,57 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; {
+ config = {
+ cynerd = {
+ router = {
+ enable = true;
+ wan = "end2";
+ lanIP = "192.168.2.1";
+ };
+ wifiAP.spt = {
+ enable = true;
+ ar9287.interface = "wlp3s0";
+ qca988x.interface = "wlp2s0";
+ };
+ monitoring.speedtest = true;
+ };
+
+ networking.useDHCP = false;
+ systemd.network = {
+ networks = {
+ "end2" = {
+ matchConfig.Name = "end2";
+ networkConfig = {
+ BindCarrier = "end2";
+ DHCP = "yes";
+ IPv6AcceptRA = "yes";
+ DHCPPrefixDelegation = "yes";
+ };
+ dhcpPrefixDelegationConfig = {
+ UplinkInterface = ":self";
+ SubnetId = 0;
+ Announce = "no";
+ };
+ linkConfig.RequiredForOnline = "routable";
+ };
+ "lan-brlan" = {
+ matchConfig.Name = "lan*";
+ networkConfig.Bridge = "brlan";
+ bridgeVLANs = [
+ {
+ bridgeVLANConfig = {
+ EgressUntagged = 1;
+ PVID = 1;
+ };
+ }
+ {bridgeVLANConfig.VLAN = 2;}
+ ];
+ };
+ };
+ };
+ };
+}