1

I have a working bond config, set via Netplan

Example, netplan config:

network:
  bonds:
    bond0:
      addresses: [10.10.10.135/26]
      gateway4: 10.10.10.128
      interfaces: [ens1f0, ens1f1]
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      parameters: {mii-monitor-interval: 100, mode: 802.3ad, transmit-hash-policy: layer3+4}
  ethernets:
    ens1f0: {dhcp4: false}
    ens1f1: {dhcp4: false}
  version: 2

Then I update Netplan config to no longer use a bond:

network:
  ethernets:
    ens1f0: {dhcp4: true}
    ens1f1: {dhcp4: true}
  version: 2

When I apply the netplan config, the individual ethernet interfaces are configured properly, but the bond is not deleted from the system.

I have to manually delete it, ex: ip link delete dev bond0

Why is this? Is there a way to make Netplan apply the config exactly as defined?

Rino Bino
  • 511
  • 5
  • 21

1 Answers1

1

The issue that you're facing is included by design. See the Known Issues portion of the netplan-apply manpage:

KNOWN ISSUES
       netplan  apply will not remove virtual devices such as bridges and bonds that have been created,
       even if they are no longer described in the netplan configuration.  That is due to the fact that
       netplan operates statelessly and is not aware of the previously defined virtal devices.

       This  can  be  resolved  by manually removing the virtual device (for example ip link delete dev
       bond0) and then running netplan apply, by rebooting, or by creating a temporary  backup  of  the
       YAML  state in /etc/netplan before modifying the configuration and passing this state to netplan
       (e.g.  mkdir -p /tmp/netplan_state_backup/etc &&  cp  -r  /etc/netplan  /tmp/netplan_state_back‐
       up/etc/ then running netplan apply –state /tmp/netplan_state_backup)