1

Suppose I set up a CentOS machine with the familiar LAMP stack, and I assign (using eth1) a dynamic IP to it via DCHP, how can I enable someone from outside my network to view the virtual machine on port 80.

Using my phone (not the host machine), I can currently see the VM on port 80 (just a simple webpage) by going to the IP 192.168.1.100, so internally my setup works with eth1 using DCHP.

Hopefully this explains my requirements betters enter image description here

  • How is your VM connected to your host's network (my network) and what do you mean by "outside my network". What's the thing separating inside from outside? – billc.cn Mar 14 '17 at 12:09
  • With a bridged connection on device eth1. Something outside my network, say a friend on the internet. I guess the overall question is "How can I use a VM as a public web server" – hd. Mar 14 '17 at 12:10
  • 3
    You need to assign a fixed IP address to the VM within your intranet, then forward port 80 to that IP within your router settings. – AFH Mar 14 '17 at 12:16
  • A bridged connection means your VM is logically on the same network as the host machine so you just need port mapping as @AFH suggested. – billc.cn Mar 14 '17 at 12:18
  • @billc.cn - It is important to assign a fixed IP, as otherwise forwarding will fail whenever the VM's IP changes. – AFH Mar 14 '17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.