LoginSignup
13
17

More than 5 years have passed since last update.

VMware上でcloneしたCentOSのNICが認識されない時の対処法

Last updated at Posted at 2016-01-04

原因

OSのNIC設定ファイルに元VMのMACアドレスが残っていることが原因
CentOS6の話です

cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:b6:70:61", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

MACアドレス"00:50:56:b6:70:61"は元VMのものだが、新しいVMのMACアドレスは"00:50:56:B6:70:61"になっている。」

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:50:56:B6:70:61"
IPV6INIT="no"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="e45dad38-c8ee-41ec-b381-820d4531799d"

対処法

  1. "70-persistent-net.rules"を空ファイルにする
rm -f /etc/udev/rules.d/70-persistent-net.rules
ln -s /dev/null /etc/udev/rules.d/70-persistent-net.rules
  1. NICの設定ファイルの編集

before

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:50:56:B6:70:61"
IPV6INIT="no"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="e45dad38-c8ee-41ec-b381-820d4531799d"

after

cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE="eth0"
BOOTPROTO="dhcp"
IPV6INIT="no"
MTU="1500"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"

確認

ll
total 16
-rw-r--r--. 1 root root 316 Oct 15  2014 60-raw.rules
-rw-r--r--. 1 root root 803 Jan  4 16:49 70-persistent-cd.rules
lrwxrwxrwx. 1 root root   9 Jan  4 17:17 70-persistent-net.rules -> /dev/null
-rw-r--r--. 1 root root  54 Dec  8  2011 99-fuse.rules
-rw-r--r--. 1 root root 341 Jan  4 16:56 99-vmware-scsi-udev.rules

Tips

このVMを元にクローンするとこの問題は二度と発生しない

13
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
17