37 lines
786 B
Nix
37 lines
786 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
boot.kernelModules = [ "bonding" ];
|
|
|
|
networking.defaultGateway.interface = "bond0";
|
|
|
|
networking.bonds.bond0 = {
|
|
interfaces = map (i: i.name) config.vars.interfaces;
|
|
driverOptions = {
|
|
# mode = "active-backup";
|
|
mode = "802.3ad";
|
|
miimon = "100";
|
|
lacp_rate = "fast";
|
|
xmit_hash_policy = "layer2+3";
|
|
};
|
|
};
|
|
|
|
networking.interfaces = lib.listToAttrs (map (iface: {
|
|
name = iface.name;
|
|
value = {
|
|
useDHCP = lib.mkForce false;
|
|
ipv4.addresses = lib.mkForce [];
|
|
};
|
|
}) config.vars.interfaces) // {
|
|
|
|
# Bond Interface Configuration
|
|
bond0 = {
|
|
useDHCP = false;
|
|
ipv4.addresses = [{
|
|
address = config.vars.local_ip;
|
|
prefixLength = 24;
|
|
}];
|
|
};
|
|
};
|
|
}
|