Posted by: kezhong | February 4, 2011

Solving the problem unable to activate NICs after moved the hard driver from a machine to another

Because there was some hardware problems on one of our servers, I moved its hard driver to another machine. After I booted the new server, I could not find NICs using ifconfig command. Restart the network service, it prompted:

# service network restart
Bringing up interface eth0:  Device eth0 does not seem to be present, delaying initialization.
[FAILED]

I Checked the message buffer of the kernel, it prompted eth0 had been renamed to eth3, and eth1 to eth2.
# dmesg|grep eth
… …
[    4.494092] udev[396]: renamed network interface eth1 to eth2
[    4.549086] udev[396]: renamed network interface eth0 to eth3

So I created the configuration files for eth2 and eth3.
# cd /etc/sysconfig/network-scripts
# mv ifcfg-eth1 ifcfg-eth2
# mv ifcfg-eth0 ifcfg-eth3

Modify the DEVICE to eth2 and eth3 in ifcfg-eth2 and ifcfg-eth3 files respectively using vi editor.

Restart the network servcie, it reminded me they used different MAC address.
# service network restart
Bringing up interface eth3:  Device eth3 has different MAC address than expected, ignoring.
[FAILED]

Get their MAC addresses, and append them to ifcfg-eth2 and ifcfg-eth3 files.
# cat /sys/class/net/eth2/address >> ifcfg-eth2
# cat /sys/class/net/eth3/address >> ifcfg-eth3

Use vi editor to change the MAC addresses to the appended.

Restart the network service again, they worked.


Responses

  1. Thanks Kezhong.
    I migrated a Parallels Linux VM to another machine and was having a very difficult time diagnosing the problem. This was precisely the solution I needed.

  2. Same here, this solved my issue with a cloned hard disk used in a different machine … thank a lot ..

  3. Excelentm thanks

  4. If this is in CentOS (6.x versions that I know of and perhaps Ubuntu), you should edit the following file:

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

    You will see entries for network interfaces and the MAC addresses. This file is created by the system on bootup. If you move the hard drive to a different machine, obviously it will have different MAC addresses. The system then adds these new MACs to the file and increments the interface number. If you have already moved the drive, delete all the entries and reboot the machine. The system will then properly identify your interfaces.

    Ideally, when you need to move a drive, you should delete this file first, shutdown, and then move it. On bootup, the system will find the new interfaces and number them starting from 0.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: