5 Answers
5

/sbin/ip link set eth1 down
/sbin/ip link set eth1 name eth123
/sbin/ip link set eth123 up

Edit:

I am leaving the below for the sake of completeness and posterity (and for informational purposes,) but I have confirmed swill's comment and Marco Macuzzo's answer that simply changing the name and device of the interface /etc/sysconfig/network-scripts/ifcfg-eth0 (and renaming the file) will cause the device to be named correctly as long as the hwaddr= field is included in the configuration file. I recommend using this method instead after the referenced update.

You may also want to make sure that you configure a udev rule, so that this will work on the next reboot too. The path for udev moved in CentOS 7 to /usr/lib/udev/rules.d/60-net.rules but you are still able to manage it the same way. If you added "net.ifnames=0 biosdevname=0" to your kernel boot string to return to the old naming scheme for your nics, you can remove

Just a note on this. If you are using CentOS 7.3, then this does not work. This is because of this issue (access.redhat.com/solutions/2592561). You will have to override the file at /etc/udev/rules.d/90-eno-fix.rules because it overrides all previously working solutions to rename the network devices.
– swillMar 15 '17 at 17:47

Looking at the advisory you referenced, it notes "This issue can be avoided by updating installation repositories to include the systemd-219-30.el7_3.6 or later package. With this newer systemd release, affected interfaces are identified upon the package install and a udev rule is automatically generated so the renaming issue is entirely avoided."
– James SheweyMar 15 '17 at 19:46

That is a different rename issue they are referring to. They are talking about the name being shortened because it is too long (I think). The udev rule that is mentioned hard codes the interface name to an eno######## value which overrides all of these attempts to rename it to something like eth0. Does that make sense? I will have to verify on my machine which version I am using, but I upgraded to the latest CentOS 7.3 yesterday, so I think I will have the version mentioned.
– swillMar 16 '17 at 21:23

Actually, the best answer I believe is the combination of the two answers already posted. In order to change the device name without restarting network services, use the ip link commands suggested by James Shewey (ip link set <old_device_name>; name <new_device_name>).

To make the changes survive a reboot in Red Hat Linux, modify the relevant file in /etc/sysconfig/network-scripts/. Rename the file ifcfg_<old_device_name> to ifcfg_<new_device_name> and change the DEVICE variable inside to <new_device_name>. Also, make sure the HWADDR variable is set and is correct. There is no need to touch udev rules, since 60-net.rules is actually there to read the ifcfg configuration files in /etc/sysconfig/network-scripts.

If you want to just work with the config files in /etc/sysconfig/network-scripts and then trigger a reload, unloading and loading the kernel module as mentioned by @Tom Hunt in the comments also works: