Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Linux virtual machine inside VMware. In the VM I set up a certain server. I want other people to be able to access that server from the internet. The router of my real machine is already set up to forward the specific port to the real computer, but how do I make the VM catch the requests from within the real computer?

share|improve this question
Is the computer that vmware is running on Linux or Windows? – racyclist Sep 18 '09 at 15:43
Windows XP. – Ram Rachum Sep 18 '09 at 15:53
up vote 2 down vote accepted

If you can use another IP on your "real" network, configure the VM's virtual network adapter to use bridging and give your VM the same configuration you would give it if it was a physical machine connected to your network; then forward the port(s) you want to your VM.

If you can't use another "real" IP, then you need to configure the VM to use NAT and VMWare's NAT service to forward the port(s) you need to it.

share|improve this answer
@Massimo: I'm attempting to do the NAT thing. I tried configuring it to forward the port, but it's still not working. Is there any more info on how to do it the NAT way? – Ram Rachum Sep 18 '09 at 17:34
You should connect the VM's virtual network card to VMNet8, give it an IP address/netmask pair suitable for that network and set it to use the default gateway specified in NAT configuration; then verify you're able to reach the external network from inside the VM. You then need to configure VMWare's NAT to forward the right port(s) to the VM's IP address on the internal network, and configure your "real" router to forward the same port(s) to your host's external address. – Massimo Sep 18 '09 at 23:53
@Massimo: The networking for the VM is set for VMNet8 which is NAT mode. I opened up Firefox from the VM and I can surf the web. I set up an apache server, and I can see its "Welcome to apache" page when I type "localhost" in Firefox on the VM. I also set VMware to forward port 80 into the VM's IP. (I checked it's the same IP.) Then I tried accessing the server from Firefox in the host operating system, Windows. It did not succeed. I also tried to access it from a different computer on the LAN, still no success. What could have gone wrong? – Ram Rachum Sep 19 '09 at 2:07
Verify that the host and the VM can talk each other. The host should be able to ping the VM's private IP, and the VM should be able to ping the host's virtual network interface on VMNet8. Also, be sure there are no active firewalls on both the host and guest systems. – Massimo Sep 19 '09 at 12:39
You nailed it - it was the VM firewall. – Ram Rachum Sep 19 '09 at 20:23

The simpler way is to have a bridged network for your virtual guest. Then redirect the traffic to its IP.

The virtual machine is on the LAN, directly, so it is your task to implement a FW for it if security is an issue (as it should)

share|improve this answer

If your Virtual server has an IP address and networking already set up, you forward the port from your router to the virtual machine's IP, not your physical computer's IP. You need to make sure that bridged networking is functional in VMWare so your virtual server is on the same network as your physical host.

share|improve this answer
I think I put it to the default of "bridged networking". But is there a way to do it without reconiguring the router? I don't mind whether the VM will have an IP or not. – Ram Rachum Sep 18 '09 at 15:59
If you're using static IPs...which you should, if you're forwarding a port could swap the IP's on the physical host and the virtual guest. If you're using DHCP then your IP's could change at any reboot, and you'll lose your connectivity to the internal server. Set a static IP on the guest and forward the port on the router to the virtual server and you should be good to go. – Bart Silverstrim Sep 18 '09 at 16:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.