I have multiple identical appliances runing CentOS 7 with four on-board NICs. To maintain a similar feel to an older version of the appliance running RHEL6 (i.e., ethX), I want to use the network naming scheme used by RHEL6. I also want to minimize the number of changes required after creating a generic system disk for use on each appliance.

If I understand the naming scheme in CentOS 7, the naming scheme is consistent based on hardware location so if the hardware is identical, I'll have the same network interface names for each instance of the appliance.

Due to customer demands, I need to make the appliance's network interfaces have the same name on the CentOS 7 and RHEL6 versions.

One approach is to extend the kernel command line with net.ifnames=0 as described here and then create my own ifcfg-ethX files. However, as near as I can tell, doing so requires manual modification of the configuration file. This is further complicated by the legacy ordering being fixed but arbitrary so I would have to modify these files for each system. :-/

One thought I had was to use the CentOS 7 naming scheme but then add an alias to each so that the arbitrary naming scheme could by applied based on hardware location. Is it possible to do this?

Any other ideas on how I can get two names to the same device and IP address?

NOTE: I am not asking how to add multiple IP addresses to the same device which is fairly straightforward.

EDIT: I really need to rename it but would like to do so programatically.


Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.

  • The eth# names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.

    Older udev versions used to automatically generate a file in /etc/udev/rules.d to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.

    You can also write custom udev rules to set the NAME= parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface to eth*, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)

  • Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch biosdevname=0). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switch net.ifnames=0).

    To get the p1p2 style names, you can yum install biosdevname, then enable it through the kernel command line (biosdevname=1 net.ifnames=0). See the Red Hat documentation.

Network interfaces cannot have aliases.

  • By arbitrary, I mean "not following a prescribed pattern" – MrMas Nov 30 '18 at 21:55
  • This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created /etc/NetworkManager/dispatcher.d/99-ifup-local.sh to do this for each of my devices. – MrMas Nov 30 '18 at 21:55

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.