Network cards changed to '__tmpXXXX' instead of ethX after reboot in Linux


We have faced a strange issue recently and would like to share that to LazySystemAdmin readers.

Problem / Issue:

After upgrading the kernel, we rebooted the server. After reboot, some of the Ethernet network cards (NIC) are renamed to '__tmpxxxx' instead of ethX. Ethernet  interface keeps changing into  '__tmpxxxx' even after two more reboot of the server.

"ifconfig -a" output is like below: Invalid network interface names after reboot
root:testsrv1#  ifconfig -a | grep HW
__tmp1428126851 Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:53
__tmp1516900339 Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:52
__tmp1854964292 Link encap:Ethernet  HWaddr 78:E7:D1:FB:B1:2F
__tmp1950613216 Link encap:Ethernet  HWaddr 78:E7:D1:FB:B1:2E
bond0     Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth0      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth1      Link encap:Ethernet  HWaddr 68:B5:99:B4:9F:E8
eth4      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth5      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:51

While checking the backup files which were taken before reboot. Network cards looks like below:
root:testsrv1# cd /root/backup-testsrv1-24-05-12/
root:testsrv1# grep HW  network-interfaces.24-05-12
bond0     Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth0      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth1      Link encap:Ethernet  HWaddr 68:B5:99:B4:9F:E8
eth2      Link encap:Ethernet  HWaddr 78:E7:D1:FB:B1:2E
eth3      Link encap:Ethernet  HWaddr 78:E7:D1:FB:B1:2F
eth4      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:50
eth5      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:51
eth6      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:52
eth7      Link encap:Ethernet  HWaddr 1C:C1:DE:72:4D:53

Why this happens? what is the root cause?

It is because of the behavior of udev. udev does not load modules sequentially but loads the modules in parallel. You will get non-deterministic Ethernet device ordering if you have Multiple Network Drivers in the machine. It's inevitable.

So, it is required to use "HWADDR= " in the ifcfg files to accomplish that mapping.

How to fix this issue?

To prevent this from occurring, the "HWADDR=" parameter should be used in /etc/sysconfig/network-scripts/ifcfg-ethX. You should mention the HWADDR in the ifcfg-eth* files or remove any "#" in start of that line and restart the network service.
# vi /etc/sysconfig/network-scripts/ifcfg-ethX
# service network restart