I have a VMware vSphere Hypervisor server with two virtual machines running ubuntu, they are just test machines while I learn more about virtualisation and servers in general.

I would like the virtual machines to be accessible from the outside world but out ISP obviously charge per IP address, or in blocks of 5 or 10.

What I would like to do is assign the hypervisor a static IP address and then depending on the domain name that's requested serve the webpage from one of the servers. Is this possible? Is the only way to have each virtual machine visible from the outside world to assign a static IP address to each one?

Any advice would be appreciated.


To be clear, I would like to run simple web servers as virtual machines (ubuntu, centOS etc.) and make them accessible from the outside world.


What you're asking is normally accomplished with a reverse proxy and NAT; the virtualization really makes no difference at all here, and I certainly wouldn't want to expose the hypervisor's management network to the Internet.

| improve this answer | |
  • So using each VM's local IP address assign it a static route using our router? – dannymcc Jun 26 '11 at 18:50
  • forget they're virtual machines right now: if they were two physical servers, how would you make them publicly-accessible? For most setups, either NAT (port forwarding to your LAN) or a DMZ (with private, NAT'ed subnet or publicly-routable subnet). – gravyface Jun 26 '11 at 18:53

That's not possible, for a start the virtual switch is just that, it's a layer 2 device, not a layer 3 one.

| improve this answer | |
  • I don't understand how I can virtualise our servers (web servers) without them being accessible from the outside world. – dannymcc Jun 26 '11 at 18:49
  • You can, you just need to understand networking and virtualisation, that's all. Basically work out how to do something called NAT, then create an internal network and NAT it to your external IP address. This is way more complex than can be explained in a question or comment. – Chopper3 Jun 26 '11 at 18:52
  • @dannymcc: You need to clarify what it is you're trying to accomplish. Is it the case that you want to run a web site on the virtual guests and make those web sites accessible from the internet? – joeqwerty Jun 26 '11 at 18:52
  • @joeqwerty Sorry - I updated my question a moment ago. @Chopper3 I'll read up on NAT, I realise it's probably unrealistic to expect an entire technology to be explained in an answer! – dannymcc Jun 26 '11 at 18:55

Making the hypervisor accessible from the internet isn't going to give you access to the guests running on the hypervisor, unless you're talking about making the hypervisor management console accessible from the internet. This would allow you to connect to the hypervisor using the VMware client. Is this what you're trying to do? If not, please fill us in on the exact details of what you're trying to accomplish.

EDIT: OK, read your edit. You need to configure port forwarding/NAT on you router to forward HTTP traffic to one of your web servers. If you need to forward HTTP traffic to both web servers you'll need another public ip address as it's not possible to forward the same port to two different hosts using the same public ip address.

Alternatively, you could run one web server on port 80 and the other on an alternate port and forward these ports to the appropriate web server with a single public ip address but the client (browser) will need to specifiy the port number when connecting to the web server running on the alternate port.

| improve this answer | |
  • our setup a reverse proxy in front of the two web servers, but I think that may be a bit over his head right now. – gravyface Jun 26 '11 at 18:57

Your Answer

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

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