This article draws from http://nxlhero.blog.51cto.com/962631/742140
VMware Workstation provides two virtual machine access methods: one is Bridge and the other is Nat. The other is the public network address, and the NAT can only be an intranet address.
Nat serves as a NAT converter. We can add Port ing so that the Internet can access the virtual machine that uses Nat to access the Internet.
The following are two examples:
The host environment used is
HOST: win7 + vmware workstation 8 Public IP Address: 118.229.240.94
Virtual Machine: fedora 8 Intranet IP Address: 192.168.126.141
Example 1: Build an HTTP server in a virtual machine and access the server using a public IP Address
1. Configure httpd
Httpd is installed in the VM. If not, yum install httpd
Start/etc/init. d/httpd start
Disable Firewall/etc/init. d/iptables stop
Run the 127.0.0.1 test on the VM and run the 192.168.126.141 test on the host.
2. Add port ing rules
Enter http: // 118.229.240.94 in the host browser, which is inaccessible because the host does not have an HTTP server.
Open VMware network editor and find the NIC used by the VM. My network is vmnet8.
Enable Nat setting
Add a port ing. We map the host port 10000 to port 80 of the VM.
OK. You can access http: // 118.229.240.94: 10000 on the host.
But it cannot be successful on a remote host. Why? Because the firewall is built on the virtual machine,Host (master machine, not remote access host)Open the firewall and manually open port 10000 of the host. For more information, see the following link:
Http://windows.microsoft.com/zh-CN/windows7/Open-a-port-in-Windows-Firewall
Example 2: SSH port ing
In the preceding method, port 10001 of the host is mapped to port 22 of the VM (port 22 is used for SSH), and you can use Putty to specify port 10001 to access the VM.