1 Introduction
Three problems encountered in the VMware virtual machine process:
- How to modify the virtual machine to a static IP and enter into force;
- After setting a static IP, no Internet access;
- After setting a static IP and can access, the host can not ping the virtual machine;
Then, the virtual machine can be achieved using a static IP, as well as access to the Internet and the virtual machine and the host communication it?
The answer is yes, here is related to the settlement process.
2, set a static IP address
VMware in the default installation is complete, it will create three virtual network environment:
- VMnet0: Bridging Network
- VMnet1 :Host-only
- VMnet8: NAT
Wherein, within the NAT represents VMWware Ubuntu installed in a subnet will, through the VMware network address translation, IP Internet through a physical machine.
We chose Ubuntu NAT way to achieve a static IP address configuration.
2.1 Setting VMware
1. Open VMware, select at the top: Edit> virtual network editor, open the virtual network editor:
2, selected VMnet8, then remove the "Use local DHCP Service Award IP address assigned to the virtual machine" in the figure below:
Here is IP subnet: 192.168.8.0, subnet mask: 255.255.255.0, therefore, in Ubuntu set IP addresses, can be set to 192.168.8.x, x may be 1 to 255.
3, select the "NAT settings" to open the NAT settings panel:
Check your gateway address, for example, the gateway here be: 192.168.8.2.
4. Finally, VMWare virtual machine management interface, select Ubuntu "Edit virtual machine settings" to open the Ubuntu virtual settings interface.
Select a network adapter, and then determines the network connection is selected "Custom" in VMnet8 (NAT mode):
VMWare set.
2.2 Ubuntu network settings
Open Terminal, configure a static ip, command is as follows:
sudo vi /etc/network/interfaces
It would read as follows:
auto lo
iface lo inet loopback
auto ens33
iface ens33 inet static
address 192.168.8.100
netmask 255.255.255.0
gateway 192.168.8.2
Note: Ubuntu15 start eth0 NIC name changed ens33.
2.3 DNS settings
Configuring the DNS, the following command:
sudo vi /etc/resolv.conf
Inside fill in DNS, such as Ali dns: 223.5.5.5
......
nameserver 223.5.5.5
......
After resetting Linux DNS preventing restart, setting the DNS permanent changes, the following command:
vim /etc/resolvconf/resolv.conf.d/base
It reads as follows:
nameserver 223.5.5.5
nameserver 8.8.8.8
2.4 Restart Network
Command is as follows:
sudo /etc/init.d/networking restart
2.5 verification
-
Ping on virtual machines in the physical machine;
-
ping physical machine on a virtual machine;
-
Ping external address on the virtual machine, such as: ping www.baidu.com ;
3. References
-
Linux virtual machines set a static IP
https://www.jianshu.com/p/2e5fecf2a7df -
vmware ubuntu set a static ip
https://www.cnblogs.com/shanhm1991/p/9902568.html