How to convert network scripts to NetworkManager config files?

Is there a command or shell script for converting a network script /etc/sysconfig/network-scripts/ifcfg-XXX to /etc/NetworkManager/system-connections/XXX.nmconnection config file?

I am currently using the ifcfg-rh plugin and it works fine, but I want to have all interface configuration at one place. I think I could rewrite it manually for one or two interfaces, but I have to do it on several servers.

Asked By: VPfB


There isn’t a straightforward simple way to do this. There might never be as converting between different configurations is fraught with error.

That said if the keyfile plugin is listed first before the ifcfg-rh plugin (check NetworkManager –print-config), then cloning the old connection profile (nmcli con clone oldprofile newprofile) will create the new cloned profile in the keyfile format. You could then switch/up to the new one.

Answered By: Kraken

Recent versions of Fedora / RHEL support nmcli conn migrate. In older versions, clone the connection and remove the old one.

Answered By: Rui
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.