Set ifcfg-eth0 after Nic replacement under centos
Today, one of the company's service hardware is broken, and the hard disk is pulled out, switched to another machine of the same model, and the mac address is changed to a new machine, later, it was discovered that the original Nic information was recorded by centos. When the service network restart was performed, it was still the original Nic, so it was necessary to know the record of the original Nic.
1. First, use the command ip add to view the mac address of the current Nic, after the NIC configuration file to find the original replacement into a new (/etc/sysconfig/network-scripts/ifcfg-eth0 find HWADDR), change DEVICE = eth0 to DEVICE = eth1 save, back up a ifcfg-eth1. Remove the ifcfg-eth0.
2. Find GATEWAYDEV = eth0 in/etc/sysconfig/network and change it to GATEWAYDEV = eth1.
3. The most important step is in etc/udev/rules. in the d/70-persistent-net.rules file, this file records the used Nic information. Note the NIC information on the original machine, that is, the record whose Nic is eth0, keep the record of the new network card (eth1 is the new network card here, according to their own situation .).
In this way, when the service network restart is enabled, the eht0 record will not be found again. The Nic starts smoothly to solve the problem!