vsphere client configuration after cloning the virtual machine (DNS resolution + MAC address + UUID + ip + host name)

1. Clone template machine

Right-click on the virtual machine you want to clone and continue to the next step.
Reference: https://www.jianshu.com/p/ebba00a0e503

2. Modify the configuration

2.1 Modify the host name

  1. Temporarily modify the host name
sudo hostnamectl set-hostname 主机名
  1. Modify the configuration file:
  • /etc/hosts
sudo vi /etc/hosts

Insert picture description here

  • /etc/sysconfig/network
sudo vi /etc/sysconfig/network

Insert picture description here
3. The reboot command restarts the server
4. Check the host name:

hostnamectl 或 hostname

2.2 Modify ip

vi /etc/sysconfig/network-scripts/ifcfg-eth32

Note: ifcfg-eth0 is the name of the network card, pay attention to what your network card name is.
Insert picture description here

2.3 Modify UUID

The UUID after cloning a virtual machine is generally the same and needs to be modified.

  1. Generate new uuid
uuidgen

Insert picture description here
2. Write the generated uuid to the network card configuration file

vi /etc/sysconfig/network-scripts/ifcfg-eth32

2.4 Delete the /etc/udev/rules.d/70-persistent-net.rules file

mv –f /etc/udev/rules.d/70-persistent-net.rules rules.back

2.5 Modify the MAC address

Modify the configuration file and delete the HWADDR content.
Insert picture description here

cat /sys/class/net/eth0/address #查看eth0的MAC地址

2.6 Configure DNS Resolution

sudo vi /etc/resolv.conf

Add to:

nameserver  8.8.8.8  

Restart the gateway:

sudo service network restart
Published 28 original articles · Likes0 · Visits 900

Guess you like

Origin blog.csdn.net/weixin_43876557/article/details/103146869