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
inherit (lib.modules) mkIf mkMerge;
enableBridge = true;
in {
imports = [
./headless.nix
@ -13,14 +14,18 @@ in {
boot = {
initrd = {
systemd.network = mkIf config.networking.useNetworkd {
networks."40-eno1" = {
inherit (config.boot.initrd.systemd.network.links.eno1) matchConfig;
inherit (config.systemd.network.networks."40-eno1") address gateway DHCP networkConfig linkConfig;
systemd.network = let
inherit (config.systemd) network;
in mkIf config.networking.useNetworkd {
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 = {
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 = [
pkgs.ipmitool
];

View file

@ -25,8 +25,8 @@
networking.useNetworkd = true;
systemd.network = {
networks."40-eno1" = {
inherit (config.systemd.network.links.eno1) matchConfig;
networks.eno1 = {
inherit (config.systemd.network.links."10-eno1") matchConfig;
address = ["10.1.1.61/24"];
gateway = ["10.1.1.1"];
DHCP = "no";
@ -37,10 +37,18 @@
Multicast = true;
};
};
links.eno1 = {
matchConfig = {
Type = "ether";
MACAddress = "54:48:10:f3:fe:aa";
links = {
"10-eno1" = {
matchConfig = {
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;
systemd.network = {
networks."40-eno1" = {
inherit (config.systemd.network.links.eno1) matchConfig;
networks.eno1 = {
inherit (config.systemd.network.links."10-eno1") matchConfig;
address = ["10.1.1.60/24"];
gateway = ["10.1.1.1"];
DHCP = "no";
@ -32,10 +32,18 @@
Multicast = true;
};
};
links.eno1 = {
matchConfig = {
Type = "ether";
MACAddress = "64:00:6a:c0:a1:4c";
links = {
"10-eno1" = {
matchConfig = {
Type = "ether";
MACAddress = "64:00:6a:c0:a1:4c";
};
};
"10-eno2" = {
matchConfig = {
Type = "ether";
MACAddress = "64:00:6a:c0:a1:4e";
};
};
};
};