1. Installation Environment
VMware 10.0.4 build-2249910
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 a static IP address for Ubuntu
3.1. Setting up IP via the network management panel
In the top right corner of the Ubuntu desktop, click the Network icon, then select "Edit Connections":
Step 1 Click the "Edit" button to open the edit page
Step 2 Method: Select Manual
Step 3 fill in the Addresses column with the IP address
Here, we set the IP address to: ip:192.168.8.100 Subnet mask: 255.255.255.0 gateway: 192.168.8.2
Then, select Save.
Finally, click on the Network icon in the top right corner of the Ubuntu desktop and select "Disconnect" to disconnect. Then open the menu and select "Connect" to connect to the Internet.
3.2. 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 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
As shown in the following:
Then, configure the DNS server:
sudo gedit/etc/resolv.conf
Fill in Ali's dns:223.5.5.5.
NameServer 223.5.5.5
Save
Close the Gedit (save first, then close), and then, on the command line, enter:
sudo/etc/init.d/networking restart
Restart the network.
4. Issues that may be encountered
4.1. Problems when setting up the network via the command line
If you restart the network, the following error occurs:
[....] Restarting networking (via Systemctl): Networking.servicejob for Networking.service failed because the control process Exi Ted with error code. See "Systemctl Status Networking.service" and "Journalctl-xe" for details.
(1) Most likely, when writing a interfaces file, the spelling error is:
When you open the interfaces file again, you can see that there are several spelling errors:
sudo gedit/etc/network/interfaces
After you modify the error, restart the network:
sudo/etc/init.d/networking restart
(2) 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.
4.2. After rebooting the system, found that the network is not available, the network icon in the upper right corner to display "Device not managed"
Workaround:
sudo gedit/etc/networkmanager/networkmanager.conf
Open the file and modify "Managed=false" to "managed=true".
Restart Network manager:
sudo service Network-manager restart
can solve the problem.
Blog Reference address: http://www.linuxdiyf.com/linux/20707.html
Set the static IP address "Go" for Ubuntu 16.04 installed in VMware virtual machines