On Mon, Feb 1, 2016 at 9:31 AM, Ricardo J. Barberis <ricardo@xxxxxxxxxxxxx> wrote: > 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. > That is interesting to know. I have not run Centos 7 in a machine with multiple ports yet, but on 6 blowing up /etc/udev/rules.d/60-net.rules would make it select the interfaces by the same order as the MAC. UPDATE: I just checked my Centos 6 box and it uses /etc/udev/rules.d/70-persistent-net.rules but in my Centos 7 vm, I only see a different file altogether [raub@duckwitch ~]$ ls -l /etc/udev/rules.d/ total 0 -rw-r--r-- 1 root root 0 Jul 25 2014 80-net-name-slot.rules [raub@duckwitch ~]$ > 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, > -- > Ricardo J. Barberis > Usuario Linux Nº 250625: http://counter.li.org/ > Usuario LFS Nº 5121: http://www.linuxfromscratch.org/ > Senior SysAdmin / IT Architect - www.DonWeb.com > _______________________________________________ > CentOS mailing list > CentOS@xxxxxxxxxx > https://lists.centos.org/mailman/listinfo/centos _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx https://lists.centos.org/mailman/listinfo/centos