Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# Ubuntu server 20.04 Change from netplan to NetworkManager for all interfaces
echo 'Changing netplan to NetowrkManager on all interfaces'
# backup existing yaml file
cd /etc/netplan
cp 01-netcfg.yaml 01-netcfg.yaml.BAK
# re-write the yaml file
cat << EOF > /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
version: 2
renderer: NetworkManager
# setup netplan for NM
netplan generate
netplan apply
# make sure NM is running
systemctl enable NetworkManager.service
systemctl restart NetworkManager.service
echo 'Done!'
Copy link

naz9ul commented Dec 8, 2020

Work like a charmed :-)

Copy link

This worked for me too on 20.04 though on running the script there was an error re 01-netcfg.yaml not being found. Thanks. 👍

Copy link

poltpolt commented Feb 8, 2022

  • added correct yaml for Ubuntu Server 20.04.3
  • added installation of networkmanager

Copy link

M00NL16H7 commented Feb 22, 2023

for anyone who may need it, i wrote a updated version for 22.04!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment