Skip to content

Commit

Permalink
nixos/networkd: Disable bond0 creation by bonding driver
Browse files Browse the repository at this point in the history
Linux defaults to creating a `bond0` interface when modprobing the
`bonding` driver, because the `max_bonds` option defaults to `1`¹.

This `bond0` interface is created with the default bond mode
`balance-rr`, which is most often undesirable.
Networkd in turn is unable to change this mode, since it does not
implement netdev recreation on parameter mismatch².

If we instead default `max_bonds=0` the driver will be loaded, but no
default interface will be created, leaving networkd in a better position
to set up the network configuration.

[1] https://www.kernel.org/doc/Documentation/networking/bonding.txt
[2] systemd/systemd#9627

Co-Authored-By: Graham Christensen <graham@grahamc.com>
  • Loading branch information
mweinelt and grahamc committed Feb 22, 2022
1 parent 67574bd commit eaae4c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nixos/modules/system/boot/networkd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,10 @@ in

(mkIf config.systemd.network.enable {

boot.extraModprobeConfig = ''
options bonding max_bonds=0
'';

users.users.systemd-network.group = "systemd-network";

systemd.additionalUpstreamSystemUnits = [
Expand Down

0 comments on commit eaae4c5

Please sign in to comment.