VMware NAT Port Map extranet can access intranet virtual machines

Source: Internet
Author: User

I want to try to use the local ip+port to access the Web server on the virtual machine, because in this way, I will be able to deploy my Web server to a network access to the server, first of all, my environment:

Host: System WIN7,IP address 172.18.186.210 virtual machine version is VMware Workstation 7, virtual machine installed CentOS operating system, IP address is 192.168.202.128, deployed lamp, become a Web server

Network Environment: Campus Network (with authentication server, need account authentication to access the Internet), virtual machine using NAT way Networking

In the campus network environment, the campus network can be regarded as the other hosts outside the network. In fact, the virtual machines use NAT networking, can let us associate with the computer network related knowledge, may regard our host as a router, then the virtual machine is in a local area network the host, the sharing router one port's address external network carries on the access, but the external network wants to access this host, You need to do port mapping on the router. So, what we have to do is to do the port mapping on VMware, the host of a port map to the virtual machine IP address, then the extranet access to the virtual machine, as long as the input of the local ip:port can access to the virtual machine. First, set up the virtual machine network:

Select: Edit--> to edit the virtual network as shown in the following illustration:





Get the following Settings window (because NAT networking is using VMNET8 this network card, so we edit this network card, click "VMnet8"):



As you can see, my virtual machine is 192.168.202.0 this segment, and we click on Nat Settings (as shown in the red box above) and the following interface appears:



Click on the Red box on the "Add", you can set the host port and virtual machine IP and port mapping, which exists in the map is I have set up, click Add after the following settings interface:


I mapped the 5901 port of the host to the "192.168.202.128" 80 port of the virtual machine, because the Web service automatically opened the port to 80, so as soon as we visited "http://172.18.186.210:5901", You can access the 80 port of the virtual machine, which is the Web service. If it was a Web server built on my previous blog post, you would have access to the "index.php" file (that is, a PHP file under the new Web server/var/www/html/,/var/www/html/ is the Web server's default Web page program directory.

In fact, the virtual machine NAT Internet and port mapping is very simple, easy to operate, of course, contains a lot of virtual network mechanism, encapsulation of the good, in the face of user transparency, it seems very intelligent. There are bridges and other ways to access the Internet, in the face of different applications, have its unique advantages, it is worth our in-depth study.

These are some of my practice and understanding, welcome to discuss. The problem can be raised in the comments, I will reply as soon as possible. Or that sentence, like to be able to point a praise, do not want to spray.

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.