RHEL7/CentOS7 – regenerate ifcfg-eth* files using nmcli

In Red Hat Enterprise Linux 7 or CentOS 7, if you need to regenerate the /etc/sysconfig/network-scripts/ifcfg-eth* files, you can do so by using the nmcli command:

To find out what devices the OS currently knows exist, use:

#nmcli device

That will return a list similar to the following:

em1           ethernet  connected     em1
em2           ethernet  connected     em2
em3           ethernet  disconnected  --
em4           ethernet  disconnected  --
lo            loopback  unmanaged     --

Then, to regenerate an ifcfg file for ’em3′, execute:

#nmcli device connect em3

That will attempt to reconnect the device, and regenerate the ifcfg-em1 file.

From there, you can do whatever it is you needed to do with the file.


2 thoughts on “RHEL7/CentOS7 – regenerate ifcfg-eth* files using nmcli

  1. i recreated enp4s0f0 …it worked..

    systemctl status NetworkManager
    systemctl start NetworkManager
    nmcli device connect enps0f0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s