"Reprint" solution for Ubuntu with Ifconfig cannot display IP address under VMware

Source: Internet
Author: User
Tags nameserver

Reproduced in HTTP://BLOG.163.COM/WJN_MCU/BLOG/STATIC/23801601620146161062704/

Background

Running the operating system under a virtual machine, especially a Linux system, is a very common practice. Sometimes you want to set up a (simulated) server under a virtual machine for host access, such as building a telnet/ssh. At this point you will find that every time you start a virtual machine, VMware assigns a dynamic IP to the virtual machine system, which makes it inconvenient to connect to the virtual machine's Telnet every time. It would be nice if it was set to a static IP.

VMnet8 and NAT

If your virtual machine is connected to the Internet in a NAT way, then the IP address of the virtual machine is not available, and the gateway and Internet access are provided by VMware's called VMnet8 Virtual network card. So all the settings related to setting up static IPs can be found here. Through the VMNET8 virtual network card, the host can access the virtual machine's IP, and the virtual machine can connect to the host's Internet connection into the extranet.

Confirm that the VMNET8 virtual network card is enabled

By default, VMWare workstation has enabled the VMNET8 virtual network card, under Windows 7, you can view the status of the virtual network card by going to Control Panel > Network and internet> Network and Sharing Center > changing adapter settings. As shown in 1-1.

Figure 1-1

Get the available IP range, gateway, and subnet mask

In the VMware main interface, click the Edit>virtual Network Editor menu to enter the virtual network card parameter Settings interface (Figure 1-2). Select the VMnet8 entry and click the NAT Settings button to see our VMware Workstation default gateway for NAT-connected virtual machines, here is 192.168.91.2, and the subnet mask, here is 255.255.255.0, As shown in 1-3.

Figure 1-2

Figure 1-3

Click the DHCP Settings button to see the range of available subnet IP VMnet8 assigned to the virtual machine, as shown in 1-4.

Figure 1-4

Here, our subnet IP available range is 192.168.91.128~192.168.91.254

OK, so far, all the information we need has been obtained, here is a summary,

-Subnet IP available range: 192.168.91.128~192.168.91.254

-Subnet Mask: 255.255.255.0

-Gateway: 192.168.91.2

Below begins to set the static IP into Ubuntu virtual machine.

Setting up a static IP in Ubuntu 12.04.1

1. Start the virtual machine Ubuntu system, open the terminal and use the following command to open and edit the network interface configuration file:

sudo vi/etc/network/interfaces

2. Edit the file as follows:

Auto loiface lo inet loopback# assgin static IP by Eric on 26-sep-2012iface eth0 inet staticaddress 192.168.91.200 #change  To your static ipnetmask 255.255.255.0  #change to your netmaskgateway 192.168.91.2    #change to your getway#we must Specify Dns-nameserver here#in order to get internet access from Hostdns-nameservers 192.168.91.2auto eth0

Description

Address is the static IP address you want to assign to your virtual machine, and you can choose one of the available subnet IP ranges we just found here.

Netmask is a subnet mask

Gateway is gateways

Note: In a relatively early version, you need to set the resolv.conf file in/etc and add nameserver so that you can connect to the Internet. However, after Ubuntu 12.04, this is not recommended, because no matter what value you want to set in the configuration file, the restart will be reverted to its original state. The recommended practice is to add the Dns-nameserver < gateway Ip> Line directly to the interfaces configuration file.

3. Restart the Ubuntu network card

sudo/etc/init.d/networking restart

4. Ping Test Internet connectivity

Ping www.baidu.com

If the ping responds, congratulations, you have successfully set the virtual machine as a static IP and are already connected to the Internet.

Note: If this does not solve the problem, it is necessary to see your VMware related programs run, open Task Manager, and then open the "service" that option, at the bottom of that page there is a "open service options", open, Then find the disabled VMware related programs, manually run the line, if you want to set up to boot, you can also right click on the mouse, click on the program's "Properties" of the option, find "Startup Type", you set the line

"Reprint" solution for Ubuntu with Ifconfig cannot display IP address under VMware

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.