How do you automatically detect a new network card in CentOS 6 / RedHat?
Solution 1:
With CentOS 6 everthing is handled by udev now. Go into /etc/udev/rules.d
and delete the 70-persistent-net.rules
file and reboot. If you open it berfore hand you will most likey see the original NIC MAC listed as eth0
and the new one as eth1
.
Now you need to edit /etc/sysconfig/network-scripts/ifcfg-eth0
and manually update to the MAC of your new NIC card.
Deleting the file forces the detection process to run again at boot with no baggage left over from the cloning process, namely the old NIC MAC address(es).
I have to do it with my CentOS 6 clones on VMware ESXi 4.1 all the time. It's a pain kudzu would just handle it in the past with previous versions.
Solution 2:
Delete the persistent rules file:
rm /etc/udev/rules.d/70-persistent-net.rules
Edit ifcfg-eth0:
nano /etc/sysconfig/network-scripts/ifcfg-eth0
REMOVE the HWADDR
line altogether (or change it to match your new NIC's MAC address).
Reboot your system:
reboot
If you change the NIC again, just repeat step #1 and # 3.
Solution 3:
You can use this tool also (This is not a GUI tool, its TUI tool, Text-based User Interface)
[root@localhost ~]# system-config-network-tui
Type above command and press Enter
Then this screen will appear
Select Device configuration and press Enter
Then this screen will appear
Here eth0 refers /etc/sysconfig/network-scripts/ifcfg-eth0
Whatever the edit made in eth0
that will affect to ifcfg-eth0
file