Set ifcfg-eth0 after Nic replacement under centos

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.