In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces VMware how to clone multiple Linux machines and configure IP, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
1. View and assign virtual networks
First of all, we need to know the difference between the three network modes of VMware.
①, Bridged (bridging mode): it is to communicate between the host network card and the virtual network card of the virtual machine using the virtual bridge. Under the action of bridging, it is similar to virtualizing the physical host as a switch, all the virtual machines set by the bridge are connected to an interface of the switch, and the physical host is also plugged into this switch. therefore, all bridged network cards and network cards are in switching mode and can access each other without interference. In bridging mode, the virtual machine ip address needs to be on the same network segment as the host, and if it needs to be connected to the network, the gateway and DNS need to be the same as the host network card.
②, NAT (Network address Translation Mode): the host network card is directly connected to the virtual NAT device, and then the virtual NAT device and the virtual DHCP server are connected to the virtual switch VMnet8, thus realizing the networking of virtual machines.
③, Host-Only (host mode only): in fact, the NAT mode removes the virtual NAT device, and then uses the VMware Network Adapter VMnet1 virtual network card to connect the VMnet1 virtual switch to communicate with the virtual machine. The Host-Only mode separates the virtual machine from the external network, making the virtual machine become an independent system and only communicate with the host.
Here we choose NAT mode.
Open the following dialog box through VMWare-> Edit-> Virtual Network Editor:
As can be seen from the above figure, the subnet IP of the virtual network card VMnet8 is 192.168.146.0, and the subnet mask is 255.255.255.0.
Click the NAT settings in the figure above:
From this we can draw the following conclusion:
Subnet ip:192.168.146.0
Subnet mask: 255.255.255.0
Default gateway: 192.168.146.2
Then we can draw the following conclusion:
Hostname ipaddress subnet mask geteway
1 、 master 192.168.146.200 255.255.255.0 192.168.146.2
1 、 slave1 192.168.146.201 255.255.255.0 192.168.146.2
1 、 slave2 192.168.146.202 255.255.255.0 192.168.146.2
The following hosts can be added in turn
Note: here you can assign virtual machine ip according to your local ip. If the host name is different, the ip address should be different.
2. Enable virtual machine service
My computer-> Administration-> Services and applications-> Services
3. Configure the network
Log in to the Linux virtual machine as root user and enter the following command to configure ip
Vi / etc/sysconfig/network-scripts/ifcfg-eth0 v
Add the following to the open file
IPADDR=192.168.146.200NETMASK=255.255.255.0GATEWAY=192.168.146.2
The final result is as follows:
DEVICE=eth0 [Network Card name]
The address of the network card corresponding to HWADDR=00:07:E9:05:E8:B4 #, that is, the mac address (can be left out of the file)
TYPE=Ethernet# indicates that the network type is Ethernet
UUID: the UUID of the network card (it can be left out of the file)
ONBOOT=yes [boot load]
BOOTPROTO=static [whether to obtain it automatically, static is a static address]
IPADDR=192.168.146.200 [configure your local IP]
NETMASK=255.255.255.0 [subnet mask]
GATEWAY=192.168.146.2 [default Gateway]
When the input is complete, press the ESC key, and then enter ": wq" to save the exit
4. Configure DNS
Vi / etc/resolv.conf
Enter:
Nameserver 192.168.146.2
When the input is complete, press the ESC key, and then enter ": wq" to save the exit
If you do not configure DNS, you can only communicate with the real physical machine, and ping www.baidu.com is impassable.
5. Restart the network card to make the configuration effective.
Server network restart
6. Turn off the firewall
If you cannot ping the real local ip address, you need to turn off the firewall.
①, effective immediately, restore after restart: service iptables start closed: service iptables stop ②, permanently effective, not enabled after restart: chkconfig iptables on closed: chkconfig iptables off
The specific actions are:
Service iptables stop
Chkconfig iptables off
Then the first virtual machine configuration is complete. Other virtual machines can then be cloned using the cloning function of vmware
Step 1: shut down the virtual machine
Shutdown-h now
Step 2: clone
Using VMware's cloning tool, right-click the virtual machine name-"manage -" clone. And then the next step is the next step.
Here we use the above virtual machine to clone another virtual machine, slave1.
Step 3: after the cloning is complete, turn on the virtual machine slave1. Then configure IP.
Note: start the cloned virtual machine after completion, and the username and password are the username and password of the cloned linux.
①, because it is a completely cloned Linux, so you need to change these items: operating system physical address, IP address, hostname
②, delete UUID from the network card, and physical address HWADDR (these two lines will be automatically generated by the operating system after Linux restart)
1. Log in to slave1 as root user and enter the following command:
Vi / etc/sysconfig/network-scripts/ifcfg-eth0
Change IP to 192.168.146.201 and remove the lines UUID and HWADDR
2. Next, modify the host name: enter it in the command
Vi / etc/sysconfig/network
Modified to:
3. Delete the file bound to the Linux physical address (this file will bind the physical address to the IP after the operating system restarts and generates the physical address)
Enter the following command:
Rm-rf / etc/udev/rules.d/70-persistent-net.rules
4. Enter shutdown-r now to restart the system
Then we type ifconfig and find that IP has changed.
Therefore: we can clone virtual machines such as slave2,slave3, and then change the IP configuration in turn to communicate with each other.
Thank you for reading this article carefully. I hope the article "how to clone multiple Linux machines and configure IP" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.