Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of binding IP addresses to multiple virtual machines of VMware

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I recently built a hadoop cluster on VMware with three virtual machines. But then a problem was discovered: every time the three machines were rebooted, the IP addresses of the three virtual machines in the VMware also changed because of the change in the network to which the host was connected. This causes the ssh to fail and the three machines cannot communicate. So I summarize a way to bind the IP address of the virtual machine.

1. After opening the virtual machine, check your IP address, subnet mask, and gateway in Edit > simulated Network Editor > NET Settings.

2. Enable virtual machine service

My computer-- > Administration-- > Services and applications-- > Services (in general, our computers have been turned on)

3. Log in to the virtual machine to be bound to IP and configure the network.

4. Log in to the Linux virtual machine as a root user and enter the following command to configure ip

Vi / etc/sysconfig/network-scripts/ifcfg-ens33

(note: the ens33 here is the name of my computer's network card, and everyone's is not necessarily the same. Check it out for yourself in the directory. Path: / etc/sysconfig/network-scripts/)

The figure above shows the current network configuration of your virtual machine. Make the following modifications:

Change BOOTPROTO='dhcp' to BOOTPROTO='static'

Enter: IPADDR= set it (I set the IP address here to: 192.168.135.132)

NETMASK=255.255.255.0 (Child pass Mask) GATEWAY=192.168.135.2 (Gateway) DNS1=8.8.8.8

As shown in the following figure:

When the input is complete, press the ESC key, and then enter ": wq" to save the exit

5. Configure DNS

Vi / etc/resolv.conf

Input: nameserver 192.168.135.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 not available.

6. Restart the Nic to make the configuration effective (you must restart the Nic after the configuration is completed)

Service network restart

Then 'ping'', the real URL: 'www.baidu.com', is successfully configured as follows, and step 7 is not required.

The above figure indicates that the configuration is successful.

7. Turn off the firewall

If you ping the local real ip address and cannot get through, then you need to turn off the firewall.

①, effective immediately, resume after restart

Enable: service iptables start

Turn off: service iptables stop

②, permanently effective, and will not be restored after restart

Enable: chkconfig iptables on

Turn off: chkconfig iptables off

Add: after binding the IP, use the ifconfig command to see if the current IP address is set for yourself.

In addition, after IP binding, the hostname may change. Modify the hostname with the following command

Modify the hostname:

1. Static hostname: vim / etc/hostname

two。 Instantaneous hostname: vim / etc/sysconfig/network

Hostname + hostname

Command to view hostname: hostnamectl

The above method of binding IP addresses to multiple virtual machines of VMware is all the content that the editor has shared with you. I hope I can give you a reference and support it.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report