How to connect a static IP address to the Internet through NAT under a virtual machine

Source: Internet
Author: User

In the past two days, some computer problems have occurred. The host can ping the Internet IP address, but the virtual machine cannot, and the virtual machine cannot even ping the Host IP address, solved the problem. :) (The network adapter set for the virtual machine is a NAT connection)

First, you can temporarily disable both the host and the virtual machine firewall because the ping IP address is restricted by the firewall, then the virtual machine should be able to ping the Host IP address.

Second, you can modify the network configuration to solve the problem that the virtual machine cannot ping the internet.

To enable the network configuration, you can set the dynamic IP Address Allocation to solve the problem that the network cannot be pinged, but because my computer usually runs securecrt, if the dynamic IP Address Allocation is set, it is troublesome to reset the IP address for each connection, so it is set as a static IP address.

First, set the network to dynamically allocate IP addresses (Don't worry). In this way, you can first view the default gateway and run the route command. Set a static IP address for the network. You can set a static IP address with a network mask of 255.255.255.0. Then, set the default gateway in the next step. The default gateway address is obtained by running the route command and then click Next, the settings are complete. In this way, you can ping the internet.

For example, if the VM address is 192.168.12.12 and the host address is 192.168.1.109, use the route command to check the default gateway address 192.168.12.2. there is also a NAT address (which can be viewed through the VMware Virtual Ethernet adapter for vmnet8 Nic In the host network connection) 192.168.12.1. how does a virtual machine connect to the Internet? First, the virtual machine connects to the NAT address through the gateway, which is equivalent to a NIC of the host, so it can connect to the Internet.

Related Article

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.