Best Practice for setting up bonding interfaces for all your machines?

What is the best practice for setting up bonding for all our machines that will be deploy with MAAS.
Do you do it in curtin preseed or do you do it with a commissioning script? If you do it in a commissioning script, doesn’t the actual deployment of the OS overwrite the bonding interface after it is install? The maas cli allows you to do this but it requires you to find the 2 interface parent id. We can not use the GUI for this since there will be hundreds of servers to deploy.

Can you point to some working example of how to set this up in the correct method?

Thanks in advance.


We have recently added management of our 100Gb data network bonds for most hardware to our provision script, which we run just before deployment. This configures the machine in MAAS, so that cloud-init configures netplan accordingly. Some sample bash code which might be helpful:

  INTERFACES=$(maas "$MAAS_USER" interfaces read "$SYSTEM_ID")
  DATA_IF_IDS=( $(echo "$INTERFACES" | jq -r ".[] | \
      select(.interface_speed == $INTERFACE_SPEED and \
      .link_connected == true).id") )
      for PARENT in "${DATA_IF_IDS[@]}"; do
        PARENTS+=( "parents=$PARENT" );
      DATA_IF_ID=$(maas "$MAAS_USER" interfaces create-bond "$SYSTEM_ID" \
          name=bond0 ${PARENTS[*]} bond_mode=802.3ad | jq -r .id)

We then create VLANs on the bond[1], then bridges on the VLAN with similar commands such as

    IP_CONFIGURED=$(maas "$MAAS_USER" interface link-subnet "$SYSTEM_ID" \
        "$BRIDGE_ID" subnet="$SUBNET_ID" mode=STATIC)

I’m happy to share more - this is just a snippet of the things in our script in case it’s of assistance.


[1] This only works if the fabric matches between VLAN and physical device - understandable but not always suitable for us. I don’t think an error is emitted when it fails, so I guess it might be a bug to follow up on at some stage. For now we simply don’t use this process for test & dev cluster machines, given that the devices are all on the prod fabric.

1 Like

Thanks for sharing this Greg.