Skip to content

Instantly share code, notes, and snippets.

@poltpolt
Forked from dbkinghorn/netplan2NM.sh
Last active April 10, 2024 13:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save poltpolt/772618cfead9c1b63b246584024d7765 to your computer and use it in GitHub Desktop.
Save poltpolt/772618cfead9c1b63b246584024d7765 to your computer and use it in GitHub Desktop.
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# netplan2NM.sh
# 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 00-installer-config.yaml 00-installer-config.yaml.orig
apt update
apt -y install network-manager
# re-write the yaml file
cat << EOF > /etc/netplan/00-installer-config.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: NetworkManager
EOF
# setup netplan for NM
netplan generate
netplan apply
# make sure NM is running
systemctl enable NetworkManager.service
systemctl restart NetworkManager.service
echo 'Done!'
@busyboy77
Copy link

perfect --- worked like a charm. for 20.04.3........Thanks

@jeremyj
Copy link

jeremyj commented Feb 25, 2022

thanks

@raspher
Copy link

raspher commented Apr 12, 2022

While using Ubuntu server with already configured wifi, there was needed to kill netplan-wls... Service and then restart networkmanager

@poltpolt
Copy link
Author

@raspher
You are right, I just didn't imagine a proper server with WiFI :)

@hrokafullur
Copy link

I believe systemd-networkd-wait-online.service needs to be disabled as well. Otherwise, it could delay the boot process in some cases for up to 2 minutes. I ended up doing:

systemctl stop systemd-networkd-wait-online.service
systemctl disable systemd-networkd-wait-online.service
systemctl mask systemd-networkd-wait-online.service

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