Set static IP address NAT for Ubuntu 16.04 installed in VMware virtual machines
1. Installation Environment
VMware 12
Ubuntu 16.04 x86_64
2. In VMware, configure the network environment
VMware creates three virtual network environments after the default installation is complete: VMnet0, VMnet1, and VMnet8. The types are: Bridged network, Host-only, and Nat. Among them, Nat indicates that Ubuntu installed in Vmwware will be in a subnet, VMware through the network address translation, through the physical computer IP Internet.
Here, we choose the NAT method to implement the static IP address configuration of Ubuntu.
Open VMware, select at the top: Edit > Virtual Network Editor to open the Virtual network editor:
First, remove the VMnet0 and VMnet1, leaving only the VMnet8. Then, remove the "Assign to virtual machine using local DHCP Service Award IP Address" as in:
In addition, here the subnet IP is: 192.168.8.0, subnet mask is: 255.255.255.0, so, in Ubuntu, set the IP address, you can set to 192.168.8.x,x can be 1~255.
Select NAT settings to open the NAT settings panel:
View your gateway address, for example, the gateway here should be: 192.168.8.2.
Finally, in VMware's virtual machine management interface, choose Ubuntu's "Edit Virtual machine settings" to open the Ubuntu virtual Setup interface.
Select the network adapter, and then make sure that the network connection is selected in VMnet8 (NAT mode) in custom:
By completing the above steps, VMware's network environment is set up.
3. Set the IP address via the terminal command line
Open the Ubuntu terminal and enter:
sudo gedit/etc/network/interfaces
Indicates that the interfaces file is opened using the Gedit editor. In the open file, if there is content, delete all first. Then enter the following code:
Auto Ens33
Iface ens33 inet Static
Address 192.168.8.100
Netmask 255.255.255.0
Gateway 192.168.8.2
Dns-nameservers 221.130.33.52 221.130.33.60
As shown in the following:
Save
Close the Gedit (save first, then close), and then, on the command line, enter:
sudo/etc/init.d/networking restart
Restart the network.
In Ubuntu version 16.04, the name of the NIC is not eth0, but ens33. Therefore, when configuring the interfaces file, do not use eth0 instead of ENS33, otherwise this problem will occur. Of course, you can check your network card status through Ifconfig.
Ubuntu16.04 Static IP Settings