On Ubuntu 18.04 LTS and Ubuntu 20, Netplan is available and replaced ifupdown by default. Let's say our interface is ens192. To check whether it's being managed by NetworkManager:
cat /run/NetworkManager/conf.d/netplan.conf
Which could output this:
[keyfile]
# devices managed by networkd
unmanaged-devices+=interface-name:ens192,
Backup the configuration file (your path or file may be different):
cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.ori
Then edit /etc/netplan/01-netcfg.yaml
to look something like:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
ethernets:
ens192:
dhcp4: false
wakeonlan: true
addresses:
- 192.168.14.2/24
gateway4: 192.168.14.1
nameservers:
addresses: [8.8.8.8]
Generate the output file with debug for extra details:
sudo netplan --debug generate
We'd like to see:
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:9991): DEBUG: 18:08:30.447: Processing input file //etc/netplan/01-netcfg.yaml..
** (generate:9991): DEBUG: 18:08:30.447: starting new processing pass
** (generate:9991): DEBUG: 18:08:30.448: ens192: setting default backend to 1
** (generate:9991): DEBUG: 18:08:30.448: Generating output files..
** (generate:9991): DEBUG: 18:08:30.449: NetworkManager: definition ens192 is not for us (backend 1)
We can see the actual configuration with:
cat /run/systemd/network/10-netplan-ens192.network
Let's make it active by:
sudo systemctl restart systemd-networkd
Be prepared to lose the connection if doing this over SSH. Do man netplan
for details. There is also a related answer on this site. See also the documentation.