Change the NIC name after cloning CentOS from vmware
I. Causes of obsessive-compulsive disorder
2. Configure the eth1 Nic properly
3. Change the NIC name eth1 to eth0
--------------------------------------
I. Causes of obsessive-compulsive disorder
When cloning a VM using VMware workstation, the NIC name is always changed, and it is no longer eth0. This is always uncomfortable. Although it can be used normally, the obsessive-compulsive disorder is very serious and it must be eth0!
2. Configure the eth1 Nic properly
Because no IP address is configured after the cloned VM is opened for the first time, you cannot use Xshell to connect to the VM or install the desktop.
1. When the cloned system is started for the first time, the NIC is not activated. You need to activate it first, and we can see that there is no eth0 Nic.
2. Activate the network adapter eth1
View Nic details
3. The eth1 Nic is configured normally.
# Setup // you can use this command to configure the nic ip address, which is omitted below.
Select Add Device
Add eth1 Nic Information
Save and exit.
4. Restart the network service. eth1 can be used normally.
5. Now you can use the Xshell tool to connect.
#ifconfig
eth1Linkencap:EthernetHWaddr00:0C:29:60:15:0F
inetaddr:192.168.2.100Bcast:192.168.2.255Mask:255.255.255.0
inet6addr:fe80::20c:29ff:fe60:150f
/64
Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:60errors:0dropped:0overruns:0frame:0
TXpackets:67errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:6219(6.0KiB)TXbytes:10975(10.7KiB)
loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1
/128
Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:0errors:0dropped:0overruns:0frame:0
TXpackets:0errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:0(0.0b)TXbytes:0(0.0b)
3. Change the NIC name eth1 to eth0
1. Delete the eth0 configuration file in the system and name the existing eth1 as eth0.
#cd/etc/sysconfig/network-scripts/
#rm-fifcfg-eth0
#mvifcfg-eth1ifcfg-eth0
#viifcfg-eth0
DEVICE=eth0
//
Change eth1 to eth0
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
HWADDR=00:0c:29:60:15:0f
IPADDR=192.168.2.100
2. Delete the first device in the configuration file, and change the name of the second device to eth0. The MAC address must be consistent with that in the NIC configuration file.
#cd/etc/udev/rules.d/
# Vi70-persistent-net.rules // status not modified
#PCIdevice0x8086:0x100f(e1000)
SUBSYSTEM==
"net"
,ACTION==
"add"
,DRIVERS==
"?*"
,ATTR{address}==
"00:0c:29:69:90:83"
,ATTR{
type
}==
"1"
,KERNEL==
"eth*"
,NAME=
"eth0"
#PCIdevice0x8086:0x100f(e1000)
SUBSYSTEM==
"net"
,ACTION==
"add"
,DRIVERS==
"?*"
,ATTR{address}==
"00:0c:29:60:15:0f"
,ATTR{
type
}==
"1"
,KERNEL==
"eth*"
,NAME=
"eth1"
# Cat70-persistent-net.rules // status after modification
#PCIdevice0x8086:0x100f(e1000)
SUBSYSTEM==
"net"
,ACTION==
"add"
,DRIVERS==
"?*"
,ATTR{address}==
"00:0c:29:60:15:0f"
,ATTR{
type
}==
"1"
,KERNEL==
"eth*"
,NAME=
"eth0"
3. restart the system and view the information.
#reboot
#ifconfig
eth0Linkencap:EthernetHWaddr00:0C:29:60:15:0F
inetaddr:192.168.2.100Bcast:192.168.2.255Mask:255.255.255.0
inet6addr:fe80::20c:29ff:fe60:150f
/64
Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:29errors:0dropped:0overruns:0frame:0
TXpackets:44errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:3655(3.5KiB)TXbytes:5385(5.2KiB)
loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1
/128
Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:0errors:0dropped:0overruns:0frame:0
TXpackets:0errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:0(0.0b)TXbytes:0(0.0b)
This article from the "one promise thousands of gold" blog, please be sure to keep this source http://hatech.blog.51cto.com/8360868/1603696