0. If the VM virtual machine has been copied, the network card is not eth0, look at the following 1---> Steps, if the copy will be copied, just look at the 1 line click I copy it. At this time the virtual opportunity at the boot time check whether the NIC address already exists, If it exists, generate another physical address and put the NIC eth0-->eht1; if it is duplicated multiple times will be eth1 ... The more you replicate the virtual machines, the larger the ifconfig you see. If you have copied the virtual machine but the NIC is not eth0, see below.
1. Generate the network card physical Address:
Copy it and use it later.
2. Modify the virtual machine NIC name $ vim/etc/udev/rules.d/70-persistent-net.rules leave the other comments off or delete only the last one, and you will find the address of the network card you just produced is here, modify the last parameter of the last line Name= " Eth0 ", 3. Then set a static IP by modifying the configuration file. If there is no ifcfg-eth0, create a new $ touch directlyIfcfg-eth0 #新建一个网卡配置文件modified to static IP, provided that you have to set the network segment of the virtual machine, do not set the network segment that can also use the default Nat vm-8 NIC $ ifconfig #查看网段, Gateway$ vim/etc/sysconfig/network-scripts/ifcfg-eth0 #把内容全删了, copy the following, change the IP, and the gateway and host name and network card address UUID to change the lineThe last UUID can generate one online:Https://www.guidgenerator.com/online-guid-generator.aspx Network card AddressHWADDRThat is, the last line in/etc/udev/rules.d/70-persistent-net.rules, that is, its own virtual machine generatedThe last reboot takes effect, restarting the NIC has some problems, it is best to restart the operating system.
DEVICE="eth0"
BOOTPROTO="static"
DNS1="1.2.4.8"
DNS2="114.114.114.114"
GATEWAY="192.168.2.1"
HOSTNAME="hadoop004"
HWADDR="00:50:56:3C:0C:D0"
IPADDR="192.168.2.5"
IPV6INIT="yes"
MTU="1500"
NETMASK="255.255.255.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="a74c2f11-2b54-4ba7-a222-aaa607fd25fb"
4. How to change your own virtual machine network segment
From for notes (Wiz)
09.VMWare virtual machine copy after Nic is not a eth0 solution