feat(c4130): br

This commit is contained in:
arcnmx 2024-11-24 16:43:19 -08:00
parent 21ed969ab7
commit 29a48ee5e5
3 changed files with 75 additions and 18 deletions

View file

@ -5,6 +5,7 @@
... ...
}: let }: let
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
enableBridge = true;
in { in {
imports = [ imports = [
./headless.nix ./headless.nix
@ -13,14 +14,18 @@ in {
boot = { boot = {
initrd = { initrd = {
systemd.network = mkIf config.networking.useNetworkd { systemd.network = let
networks."40-eno1" = { inherit (config.systemd) network;
inherit (config.boot.initrd.systemd.network.links.eno1) matchConfig; in mkIf config.networking.useNetworkd {
inherit (config.systemd.network.networks."40-eno1") address gateway DHCP networkConfig linkConfig; networks = {
eno1 = {
inherit (config.boot.initrd.systemd.network.links."10-eno1") matchConfig;
inherit (network.networks.eno1) address gateway DHCP networkConfig linkConfig;
};
}; };
links.eno1 = { links."10-eno1" = {
matchConfig = { matchConfig = {
inherit (config.systemd.network.links.eno1.matchConfig) Type MACAddress; inherit (network.links."10-eno1".matchConfig) Type MACAddress;
}; };
}; };
}; };
@ -31,6 +36,42 @@ in {
}; };
}; };
systemd.network = let
inherit (config.systemd) network;
in {
networks = {
br = mkIf enableBridge {
matchConfig.Name = "br";
DHCP = "no";
linkConfig = {
RequiredForOnline = false;
Multicast = true;
};
networkConfig = {
IPv6AcceptRA = false;
MulticastDNS = true;
};
};
eno2 = {
inherit (network.links."10-eno2") matchConfig;
bridge = mkIf enableBridge ["br"];
linkConfig = {
RequiredForOnline = false;
#ActivationPolicy = mkIf (!enableBridge) "manual";
};
};
};
netdevs = {
br = mkIf enableBridge {
netdevConfig = {
Name = "br";
Kind = "bridge";
inherit (network.links."10-eno2".matchConfig) MACAddress;
};
};
};
};
environment.systemPackages = [ environment.systemPackages = [
pkgs.ipmitool pkgs.ipmitool
]; ];

View file

@ -25,8 +25,8 @@
networking.useNetworkd = true; networking.useNetworkd = true;
systemd.network = { systemd.network = {
networks."40-eno1" = { networks.eno1 = {
inherit (config.systemd.network.links.eno1) matchConfig; inherit (config.systemd.network.links."10-eno1") matchConfig;
address = ["10.1.1.61/24"]; address = ["10.1.1.61/24"];
gateway = ["10.1.1.1"]; gateway = ["10.1.1.1"];
DHCP = "no"; DHCP = "no";
@ -37,10 +37,18 @@
Multicast = true; Multicast = true;
}; };
}; };
links.eno1 = { links = {
matchConfig = { "10-eno1" = {
Type = "ether"; matchConfig = {
MACAddress = "54:48:10:f3:fe:aa"; Type = "ether";
MACAddress = "54:48:10:f3:fe:aa";
};
};
"10-eno2" = {
matchConfig = {
Type = "ether";
MACAddress = "54:48:10:f3:fe:ac";
};
}; };
}; };
}; };

View file

@ -20,8 +20,8 @@
networking.useNetworkd = true; networking.useNetworkd = true;
systemd.network = { systemd.network = {
networks."40-eno1" = { networks.eno1 = {
inherit (config.systemd.network.links.eno1) matchConfig; inherit (config.systemd.network.links."10-eno1") matchConfig;
address = ["10.1.1.60/24"]; address = ["10.1.1.60/24"];
gateway = ["10.1.1.1"]; gateway = ["10.1.1.1"];
DHCP = "no"; DHCP = "no";
@ -32,10 +32,18 @@
Multicast = true; Multicast = true;
}; };
}; };
links.eno1 = { links = {
matchConfig = { "10-eno1" = {
Type = "ether"; matchConfig = {
MACAddress = "64:00:6a:c0:a1:4c"; Type = "ether";
MACAddress = "64:00:6a:c0:a1:4c";
};
};
"10-eno2" = {
matchConfig = {
Type = "ether";
MACAddress = "64:00:6a:c0:a1:4e";
};
}; };
}; };
}; };