This article explains a few different methods that can be used to rename interfaces on CentOS/Fedora.

Method 1 Link to heading

  • Log in to the machine and open the network configuration GUI
[stuart@asuka ~]$ sudo system-config-network
  • Click on the 'Hardware' tab
  • Select interface and click 'Edit'
  • Click the 'Device' dropdown and select the new name for the interface

Note: If renaming a device from eth2 to eth1, make sure that the name eth1 is available, there already may be a device called eth1 which should be renamed to eth0 first

  • Close the network configuration GUI and save changes
  • Restart the machine
[stuart@asuka ~]$ init 6

Fix Continued... [If previous steps didn't work] Link to heading

  • Change the name of the interface in /etc/udev/rules.d/70-persistant-net.rules
NAME="eth**X**"    ---->    NAME="eth**Y**"
  • Set up ifcfg file for the interface
[stuart@asuka ~]$ sudo cp /etc/sysconfig/network-scripts/ifcfg-eth**X** /etc/sysconfig/network-scripts/ifcfg-eth**Y**
  • Replace old interface name in /etc/sysconfig/network-scripts/ifcfg-eth**Y**
[stuart@asuka ~]$ sudo sed -i 's/eth**X**/eth**Y**/g' /etc/sysconfig/network-scripts/ifcfg-eth**Y**
  • Restart services
[stuart@asuka ~]$ sudo start_udev
[stuart@asuka ~]$ sudo systemctl restart network

Fix Continued... [If previous steps didn't work] Link to heading

  • Rename the interface
[stuart@asuka ~]$ sudo ifrename -u -i ethX -n ethY
  • Turn off and stop Network Manager
[stuart@asuka ~]$ sudo systemctl stop NetworkManager
[stuart@asuka ~]$ sudo systemctl disable NetworkManager
  • Restart services
[stuart@asuka ~]$ sudo start_udev
[stuart@asuka ~]$ sudo service network restart

Fix Continued... [If previous steps didn't work] Link to heading

  • Backup old ifcfg files (ensure that IPMI or physical access with a monitor & keyboard is available to the server before doing this)
[stuart@asuka ~]$ sudo mkdir /etc/sysconfig/network-scripts/OLD/
[stuart@asuka ~]$ sudo mv /etc/sysconfig/network-scripts/ifcfg-eth* /etc/sysconfig/network-scripts/OLD/
  • Reboot the machine
  • Check interface names
[stuart@asuka ~]$ ifconfig -a

If all looks correct then configure the network interface ifcfg files again