DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Fix NIC Name of Cloned CentOS VMs


Sometimes the NIC name in output of ip addr or ifconfig is not the same with that defined in /etc/sysconfig/network-scripts/ifcfg-eth0, for example, in ifcfg-eth0, the first line is:

DEVICE="eth0"

but the output of ip addr is:

2: eth1: <BROADCAST...

This is because the source of ip addr is /etc/udev/rules.d/70-persistent-net.rules. Edit this file to correct the NIC name.

The total step to fix network of a centos VM is:

  1. vi /etc/sysconfig/network // fix hostname and gateway IP

  2. vi /etc/sysconfig/network-scripts/ifcfg-eth0 // fix NIC name, host IP and netmask

  3. vi /etc/udev/rules.d/70-persistent-net.rules // NIC name and hardware address should be the same with that in file ifcfg-eth0

  4. reboot

Update 2014-9-19

The MAC address is determined by ifconfig -a, so copy IP address after "HWaddr" in command output, and modify "HWADDR" in /etc/.../ifcfg-eth0, then sudo service network restart.



Published

Jul 23, 2014

Last Updated

Jul 23, 2014

Category

Tech

Tags

  • centos 25
  • config 7
  • interface 1
  • network 9

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor