Set a static IP address for Ubuntu 16.04 installed in VMware virtual machines

Source: Internet
Author: User

Tag: Code will also UIL admin init with and add open

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 the static IP address for Ubuntu 3.1 set IP through 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 Setting 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:

AutoLoIfaceLoinetLoopbackAutoEns33IfaceEns33inetStaticAddress 192.168.8.100Netmask 255.255. 255. 0Gateway 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 you may experience when you set up the network by using the command line 4.1

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 upper right corner of the network icon click 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.

Set a static IP address for Ubuntu 16.04 installed in VMware virtual machines

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.