0

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.

4
  • Did you enable the NetworkManager.service so that it starts up when the system reboots? See help.ubuntu.com/community/NetworkManager
    – Terrance
    Nov 24 at 16:49
  • Thanks @Terrance. I'm think that, after that reboot, NetworkManager was already running since nmtui and nmcli worked Nov 26 at 10:18
  • I think one of the problems is that your devices end up being unmanaged. To fix this all you really need to do is to touch a file for Network Manager to manage the devices (interfaces). sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
    – Terrance
    4 hours ago
  • Just ran a test in Ubuntu 22.04 where I installed NetworkManager and made sure that nmcli 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
    3 hours ago

1 Answer 1

1

I believe the fact you didn't disable systemd-networkd (I suppose) has something to do with your issue.

Try this in a testing machine:

  • install network-manager

  • edit your netplan yaml file created by the installer and just add the line renderer: NetworkManager

  • netplan generate (to generate the network manager file) and check if it's there (/run/NetworkManager/system-connections)

  • edit the netplan yaml file again and change it to have the content you mentioned above

  • mask (systemctl mask ) all the networkd services you find with "systemctl | grep network"

  • reboot your system (or simply netplan apply, but it will possibly get a different IP address and your connection will drop anyway)

I have tested it on an Ubuntu 22.04 server installation.

New contributor
Danilo Egea Gondolfo is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.