I see that Ubuntu server after the installation comes as default with NetPlan with a DHCP configuration (at least in Ubuntu 22.04 focal fossa).
Some users don't want NetPlan and just want NetworkManager, for example to use nmcli
, nmtui
, or import VPN configurations etc. and so after the installation I think it's frequent to migrate to NetworkManager.
At the moment this is my procedure to migrate from NetPlan to NetworkManager after a clean installation.
Create this file:
/etc/netplan/01-er-netplan-fix.yaml
With this content:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
# Set and change netplan renderer to NetworkManager GUI tool
network:
version: 2
renderer: NetworkManager
Then run these commands:
# install Network Manager
sudo apt install network-manager
disable NetPlan
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak
reload NetPlan
netplan apply
I'm not proud of this but I reboot to apply everything now
reboot
Problem: when I reboot, the server obviously disconnects, but also it never renews its IP via DHCP.
As workaround, I open a physical terminal on the server, I run dhclient
, and then I continue with nmtui
adding a simple Ethernet configuration with DHCP, and everything is good again.
So my question is: how to migrate from NetPlan to NetworkManager? Possibly automatically renewing its IP? Possibly without any disconnection at all? so your SSH connection is not interrupted.
Feel free to suggest as answer to prefill at least a valid NetworkManager configuration for a valid DHCP after the reboot but I still don't understand if I can also avoid the reboot at all and keep a working SSH connection to do the whole migration process.
Thank you for your thoughts! Maybe this question is stupid but I don't know NetPlan, since I usually use Debian and I don't have these problems.
sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
– Terrance Dec 04 '22 at 20:44nmcli
was working. Then I removed Netplan.io completely.sudo apt remove --purge netplan.io
. Then I did the above comment with touching the file. Rebooted and network came right back up with the last IP address and didn't renew to a new DHCP IP address. – Terrance Dec 04 '22 at 21:01