Bonding Interface w/ LACP (802.3ad)

This example configures a bond interface with two physical interfaces using LACP (IEEE 802.3ad) with fast timers:

  • create a bond interface bond0
  • add an ipv4 address to bond0
  • assign phyiscal interfaces to bond0
  • set the physical interfaces links to up
interfaces:
  # bonding interface
  bond0:
    addresses:
    - 192.0.2.1/24
    link:
      state: up
      kind: bond
      bond_mode: 802.3ad
      bond_ad_lacp_rate: fast
      bond_xmit_hash_policy: layer3+4
      bond_miimon: 100
      bond_updelay: 300
  # first physical interface
  port1:
    link:
      state: up
      kind: physical
      master: bond0
    identify:
      parent_dev_name: '0000:03:00.0'
      parent_dev_bus_name: pci
  # second physical interface
  port2:
    link:
      state: up
      kind: physical
      master: bond0
    identify:
      parent_dev_name: '0000:03:00.0'
      parent_dev_bus_name: pci
{
  networking.ifstate = {
    enable = true;
    settings = {
      interfaces = {
        # bonding interface
        bond0 = {
          addresses = [ "192.0.2.1/24" ];
          link = {
            state = "up";
            kind = "bond";
            bond_mode = "802.3ad";
            bond_ad_lacp_rate = "fast";
            bond_xmit_hash_policy = "layer3+4";
            bond_miimon = 100;
            bond_updelay = 300;
          };
        };
        # first physical interface
        port1 = {
          link = {
            state = "up";
            kind = "physical";
            master = "bond0";
          };
          identify = {
            parent_dev_name = "0000:03:00.0";
            parent_dev_bus_name = "pci";
          };
        };
        # second physical interface
        port2 = {
          link = {
            state = "up";
            kind = "physical";
            master = "bond0";
          };
          identify = {
            parent_dev_name = "0000:03:00.0";
            parent_dev_bus_name = "pci";
          };
        };
      };
    };
  };
}
# bonding interface
ip link add name bond0 type bond lacp_rate 1 miimon 100 mode 802.3ad \
  xmit_hash_policy layer3+4 updelay 300
ip link set bond0 up
ip address add 192.0.2.1/24 dev bond0
# first physical interface
ip link set dev eth0 name port1 up
ip link set dev port1 master bond0
ip link set dev port1 up
# second physical interface
ip link set dev eth1 name port2 up
ip link set dev port2 master bond0
ip link set dev port2 up