Support explicitly excluding an interface from netplan's handling

Bug #1918198 reported by Dan Watkins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Netplan
New
Undecided
Unassigned

Bug Description

In bug 1914784, it was requested that cloud-init provide a way of disabling the configuration of an interface: as our network configuration format is a subset of netplan's configuration format, we need to come to an agreement on how this should work on Ubuntu (and then we can implement it for the non-netplan backends in cloud-init).

Lukas described a workaround for that specific bug (in https://bugs.launchpad.net/cloud-init/+bug/1914784/comments/4): as they were targetting a NetworkManager-enabled system, they could mark all of the "excluded" interfaces as managed-by-networkd, meaning that netplan explicitly disables them in NM.

This, however, has a flaw: if network configuration is being authored (or generated) for systems which could boot with either NetworkManager or networkd (e.g. a cloud generating network config for launched instances, which could have any distro within) then it will only work for NM-enabled systems: on the other systems, the interfaces would explicitly _be_ managed by networkd. Lukas mentioned that networkd-specific configuration could (soon) be specified to have networkd keep the interface DOWN, but this seems a little round-about.

What I think we need is a configuration toggle that, regardless of network backend, will cause netplan to configure the system such that that interface is left alone for the operator of the system to do with as they wish.

Tags: fr-1209
Revision history for this message
Dan Watkins (oddbloke) wrote :

An alternative might be a way to explicitly configure netplan's "default" behaviour: currently it defaults to "manage every interface" with NetworkManager, but "manage only the specified interfaces" with networkd. If there were a non-backend-specific configuration option which allowed a config author to express "only manage the interfaces specified in this config" which would be honoured on both NM and networkd systems.

Revision history for this message
Lukas Märdian (slyon) wrote :

This is not really a netplan default, but rather a NetworkManager default, as defined in `/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf`, so I think we should consider if we want to change that globally in the network-manager package, instead of overriding the global default via netplan.

TBF, netplan already changes that config a bit in some situations, when NetworkManager is set as the default renderer, by overriding it with an empty file in `/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf`.

```
$ cat /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma
```

Another option I could think of to handle this on a more case-to-case base, would be to introduce a new `ignored-devices` top level stanza in netplan, allowing to explicitly ignore given interfaces. I need to consult the netplan team about this, but it could look like this:
```
network:
  version: 2
  renderer: networkd
  ignored-devices: [eth1]
  ethernets:
    eth0:
      dhcp4: true
```

Revision history for this message
Dan Watkins (oddbloke) wrote :

> This is not really a netplan default, but rather a NetworkManager default, as defined in `/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf`, so I think we should consider if we want to change that globally in the network-manager package, instead of overriding the global default via netplan.

cloud-init does not only run on Ubuntu, so we need be able to expres this in netplan configuration so users on other distros (who will have upstream NM's default behaviour, and for whom cloud-init generates network configuration) are able to manage it. (Notionally, netplan is also cross-distro, right?)

(If we _also_ want to change the NM package's behaviour on Ubuntu, that's fine by me, but I suspect we'd regress desktop usecases?)

> Another option I could think of to handle this on a more case-to-case base, would be to introduce a new `ignored-devices` top level stanza in netplan, allowing to explicitly ignore given interfaces.

This looks like a promising direction; thanks!

Revision history for this message
Lukas Märdian (slyon) wrote :

> cloud-init does not only run on Ubuntu, so we need be able to expres this in netplan configuration so users on other distros (who will have upstream NM's default behaviour, and for whom cloud-init generates network configuration) are able to manage it. (Notionally, netplan is also cross-distro, right?)
>
> (If we _also_ want to change the NM package's behaviour on Ubuntu, that's fine by me, but I suspect we'd regress desktop usecases?)

Yes, netplan is cross-distro as well. And it is also shipped in basically every modern Ubuntu installation (incl. Desktop), so if we ship the drop-in config for changing the default, we would most probably regress Desktop as well.

> This looks like a promising direction; thanks!

Cool! I prefer this approach and will continue to investigate this direction.

tags: added: fr-1209
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.