In Linux, how does one change the network adapter eth1 to eth0?

Source: Internet
Author: User

In Linux, how does one change the network adapter eth1 to eth0?

Normally, eth0 and eth1. Sometimes, when we use the VM cloning technology, the NIC information changes, and the name of the new VM Nic may change to eth1. no matter how we modify it, this has plagued us with the use of N virtual machines for the HA-heartbeat experiment.

This is because an Eni has been identified as eth0 in/etc/udev/rules. d/70-persistent-net.rules and eth1 in the virtual machine.

Solution:

1. edit/etc/udev/rules. d/70-persistent-net.rules, find the same line of MAC as ifconfig-a (NAME = 'eth1'), and change it to "NAME = eth0 ", delete the above line (NAME = 'eth0.

Vim/etc/udev/rules. d/70-persistent-net.rules

SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 0c: 29: bb: 41: 2b ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0"

2. edit/etc/sysconfig/network-script/ifcfg-eth0, change MAC to correct, delete UUID.

3. edit/etc/sysconf/network and change the hostname.

4. the restart takes effect!

This article permanently updates the link address:

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.