The extranet host accesses the Web server under the virtual machine (NAT port forwarding)

Source: Internet
Author: User

Host: System Win7,ip address 172.18.186.210

Virtual machines: VMware Workstation 7, the CentOS operating system is installed under the virtual machine, the IP address is 192.168.202.128, and the lamp is deployed as a Web server

Network Environment: Campus Network (with authentication server, need account authentication to surf the Internet), virtual machine using NAT Way Network

In the campus network environment, can be the campus network of other hosts as an external network host. In fact, the virtual machine using the NAT network, can let us associate with the computer network knowledge, we can think of our host as a router, and then the virtual machine is in a LAN in a host, shared router a port address to the external network access, but the external network to access the host, You need to do port mapping on the router. So, what we have to do is to do port mapping on VMware, to map one port of the host to the IP address of the virtual machine, then the extranet accesses the virtual machine, so long as the ip:port of the input host can access the virtual machine. First, set up the virtual machine network:

Select: Edit--Edit the virtual network as shown in:

Get the following Setup window (because NAT is connected using VMnet8, so we edit this NIC and click "VMnet8"):

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

Click on the Red box "ADD", you can set the host port and the virtual machine IP and port mapping, the presence of the mapping is I have been set up, click on Add will appear following the Settings screen:

I mapped the host's 5901 port to the "192.168.202.128" 80 port of the virtual machine because the Web service auto-open port is 80, so as soon as we access "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 that was built on my previous blog post, you would have access to the file "index.php" (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 under the NAT Internet and port mapping are very simple, easy to operate, of course, it contains a lot of virtual network mechanism, packaging good, face the user transparent, it seems very smart. There are bridges and other internet ways, in the face of different applications, have its unique advantages, it is worth our deep learning.

The extranet host accesses the Web server under the virtual machine (NAT port forwarding)

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.