The issue here may be systemd (I've seen/agree with the venting, this is another example). If you're getting non-eth names there's a program called biosdevname which may be deciding how to name NICs for you. If that's the case then then the <nn>-net.rules may be ineffective unless the following is added as kernel command line parameters:
net.ifnames=1 and biosdevname=0
I need to add big cautions here, my experience with this is on Ubuntu (where it's 70-net.rules) and a hardware platform which has 10 NICs. systemd/biosdevname... named the first six NICs 'ens...' and the last four 'eth...'. (<rant> I really do wish the developers would stop trying to decide what's best for us and leave control in our hands or at least provide documentation which is easily findable that allows us to take control back. </rant>). Web documentation at freedesktop.org says net.ifnames needs to be set to zero, I found just the opposite but if it doesn't work for you try both before giving up. I know where to set these parameters on Ubuntu but you'll have to find where on CentOS. Hope this helps.
----- Original Message ----- From: "Ricardo J. Barberis" ricardo@palmtx.com.ar To: "CentOS mailing list" centos@centos.org Sent: Monday, February 1, 2016 8:31:42 AM Subject: Re: [CentOS] NICs order
El Lunes 01/02/2016, Daniel Ruiz Molina escribió:
Hi,
After installing CentOS 7 in a server with 2 NICs, system detects eth0 and eth1 in reserve order. I would like to have eth1 as eth0 and eth0 as eth1. I have forced HWADDR attribute in /etc/sysconfig/network-scripts/ifcfg-etc{0,1}, but after rebooting, order is the same...
How can I solve it?
Thanks.
You could put the MAC addresses in /etc/udev/rules.d/60-net.rules, e.g.:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:aa:bb:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="44:55:66:dd:ee:ff", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
But that never worked reliably for me, no matter what I tried.
In the end I had to use different names instead of eth0 and eth1, like:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:aa:bb:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="nic0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="44:55:66:dd:ee:ff", ATTR{type}=="1", KERNEL=="eth*", NAME="nic1"
And also rename /etc/sysconfig/network-scripts/ifcfg-ethX to ifcfg-nicX and modify them accordingly.
HTH,