mob next [ci-skip] [ci skip] [skip ci]

lastFile:clan.nix
This commit is contained in:
2026-08-10 16:55:43 +07:00
parent 049270c2ca
commit fdf53873cb
3 changed files with 49 additions and 101 deletions
+47 -99
View File
@@ -1,4 +1,9 @@
{ inputs, self, ... }:
{
inputs,
self,
libNet,
...
}:
let
hosts = import ./modules/hosts.nix;
@@ -60,111 +65,54 @@ in
name = "gw-router";
input = "self";
};
roles.default.machines."gw-cnx-1" = {
settings = {
wan = {
interface = "enp1s0";
vlanId = null;
roles.default.machines."gw-cnx-1" =
let
genVlan = id: length: rec {
inherit id;
prefixLength = length;
subnet = libNet.net.cidr.make length "10.0.${id}.0";
address = libNet.net.cidr.host 1 subnet;
dhcp.pool.from = libNet.net.cidr.host 100 subnet;
dhcp.pool.to = libNet.net.cidr.host 200 subnet;
};
vlans = {
mgmt = {
id = 10;
address = "10.1.10.1";
prefixLength = 24;
subnet = "10.1.10.0/24";
dhcp.fixedIPs.storinator01 = {
hwAddress = "7c:c2:55:e0:d6:40";
ipAddress = "10.1.10.53";
in
{
settings = {
wan = {
interface = "enp1s0";
vlanId = null;
};
vlans = {
mgmt = genVlan 10 24 // {
dhcp.fixedIPs.storinator01 = {
hwAddress = "7c:c2:55:e0:d6:40";
ipAddress = "10.1.10.53";
};
};
dhcp.pool.from = "10.1.10.100";
dhcp.pool.to = "10.1.10.200";
};
lan = {
id = 20;
address = "10.1.20.1";
prefixLength = 24;
subnet = "10.1.20.0/24";
dhcp.pool.from = "10.1.20.100";
dhcp.pool.to = "10.1.20.200";
};
iot = {
id = 40;
address = "10.1.40.1";
prefixLength = 24;
subnet = "10.1.40.0/24";
dhcp.pool.from = "10.1.40.100";
dhcp.pool.to = "10.1.40.200";
};
voip = {
id = 50;
address = "10.1.50.1";
prefixLength = 24;
subnet = "10.1.50.0/24";
dhcp.pool.from = "10.1.50.100";
dhcp.pool.to = "10.1.50.200";
};
dmz = {
id = 60;
address = "10.1.60.1";
prefixLength = 24;
subnet = "10.1.60.0/24";
dhcp.pool.from = "10.1.60.100";
dhcp.pool.to = "10.1.60.200";
};
unit1 = {
id = 110;
address = "10.1.110.1";
prefixLength = 24;
subnet = "10.1.110.0/24";
dhcp.pool.from = "10.1.110.100";
dhcp.pool.to = "10.1.110.200";
};
unit2 = {
id = 120;
address = "10.1.120.1";
prefixLength = 24;
subnet = "10.1.120.0/24";
dhcp.pool.from = "10.1.120.100";
dhcp.pool.to = "10.1.120.200";
};
unit3 = {
id = 130;
address = "10.1.130.1";
prefixLength = 24;
subnet = "10.1.130.0/24";
dhcp.pool.from = "10.1.130.100";
dhcp.pool.to = "10.1.130.200";
};
unit4 = {
id = 140;
address = "10.1.140.1";
prefixLength = 24;
subnet = "10.1.140.0/24";
dhcp.pool.from = "10.1.140.100";
dhcp.pool.to = "10.1.140.200";
};
unit5 = {
id = 150;
address = "10.1.150.1";
prefixLength = 24;
subnet = "10.1.150.0/24";
dhcp.fixedIPs.newt = {
hwAddress = "7c:d3:0a:21:58:0b";
ipAddress = "10.1.150.22";
lan = genVlan 20 24;
iot = genVlan 40 24;
voip = genVlan 50 24;
dmz = genVlan 60 24;
unit1 = genVlan 110 24;
unit2 = genVlan 120 24;
unit3 = genVlan 130 24;
unit4 = genVlan 140 24;
unit5 = genVlan 150 24 // {
dhcp.fixedIPs.newt = {
hwAddress = "7c:d3:0a:21:58:0b";
ipAddress = "10.1.150.22";
};
};
dhcp.pool.from = "10.1.150.100";
dhcp.pool.to = "10.1.150.200";
};
};
trunkPorts = [ "enp2s0" ];
trunkPorts = [ "enp2s0" ];
accessPorts = {
enp4s0.vlanId = 10;
};
accessPorts = {
enp4s0.vlanId = 10;
};
upLinkPorts = [ "enp3s0" ];
upLinkPorts = [ "enp3s0" ];
};
};
};
};
root-user = {