1

I have an Ubuntu Server virtual machine running apache installed on Fedora. How can I forward external web requests to my virtual server?

So I have my host (fedora) running on 142.204.142.182 I have my virtual machine (ubuntu) running on 192.168.100.136

How can i make it so when someone requests 142.204.142.182 on a separate computer (from their web browser), my host forwards the request to the virtual machine and therefore pages are served from the VM.

3 Answers 3

1

If the Ubuntu VM is the only publicly available webserver on your LAN, then you can portforward all incoming requests for TCP/80 on your firewall/router to 192.168.100.136.

You have a problem when you need more internal hosts to be publicly available webservers. You need to either get more public IP addresses, or set up the 192.168.100.136 webserver to proxy all requests to different webservers, depending on the Host header of the incoming request.

This is called a reverse-proxy, and is quite easy to setup with Apache. The downside is that the load on the 136 webserver will increase because it proxies all traffic. The upside is that it can serve as a cache as well, reducing the load on the other webservers. Speaking of which...

Another option, similar to the Apache reverse-proxy, is installing a load-balancer, such as Varnish, and portforward your incoming TCP/80 traffic to that load-balancer. In the load-balancer you can define rules to define which requests are handled by which internal servers. In effect this is a reverse-proxy as well, but load-balancers such as Varnish are more advanced in their caching methods and configuration.

1

Unless I am completely misunderstanding your question, just make sure your DNS for the hosted site points at the IP address of the virtual machine, ensure there is no firewall getting in the way and the correct routing is in place.

If that doesn't answer your question, then please elaborate in more detail.

3
  • I added more info.
    – Petey B
    Sep 12, 2010 at 18:39
  • In this case, Martjin's answer is the correct one.
    – wolfgangsz
    Sep 12, 2010 at 19:28
  • Something I almost forgot: since your VM runs on a private LAN IP address, your host will also need an IP address on the same LAN, otherwise it cannot route the traffic. The host cannot see the IP address of the VM directly.
    – wolfgangsz
    Sep 12, 2010 at 22:14
1

Is the VM's NIC set for NAT by chance? If so, is there a "hard" requirement for it to be NATted? If not, why not just set the VM's NIC to "bridge" mode and assign it a working (for your network) 142.204.x.x address?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .