NetworkManager and Netplan¶
Ubuntu Core’s default Netplan configuration defers networking to networkd.
When Network Manager is installed (snap install network-manager), a new Netplan configuration replaces networkd with network-manager, taking control of all networking devices.
This behaviour can be controlled with the defaultrenderer snap option. By default, this is set to true to allow network-manger to control networking. If set to false, network-manager reverts the default Netplan configuration, giving control of network devices back to networkd.
snap set network-manager defaultrenderer=false
Note that only devices explicitly configured within Netplan configuration files, usually only ethernet or wifi, are given back to networkd.
YAML backend¶
From core20 onwards, network-manager been modified to use a YAML backend that’s based on libnetplan functionality.
The YAML backend replaces the keyfile format used by Network Manager with /etc/netplan/*.yaml.
The default configuration, for example, can be output by running the sudo cat /etc/netplan/00-snapd-config.yaml to produce show following output:
# This is the network config written by 'console-conf'
network:
ethernets:
enp0s2:
dhcp4: true
version: 2
On boot the netplan.io generator processes all of the YAML files and renders them into the corresponding a Network Manager configuration in /run/NetworkManager/system-connections. The usual netplan generate/try/apply can be used to re-generate this configuration after the YAML was modified.
If a connection profile is modified or created from within Network Manager, such as updating a Wi-Fi password with nmcli, Network Manager will create an ephemeral keyfile that will be immediately converted to Netplan YAML and stored in /etc/netplan. Network Manager automatically calls netplan generate to re-process the current YAML configuration to render Network Manager connection profiles in /run/NetworkManager/system-connections.
The system wide network configuration can be read with sudo netplan get:
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s2:
dhcp4: true
System wide network settings can be modified with netplan set:
sudo netplan set ethernets.enp0s2.addresses=[10.0.2.15/24]
Configuration options that are not supported by the Network Manager YAML backend are stored in a networkmanager.passthrough YAML mapping to ensure they are not lost during the Netplan conversion.