How to get public IPs on ESXi VMs

addressiproutingvirtual-machinesvmware-esxi

We have a dedicated server with a hosting provider. We are running ESXi 6.0. The server has a single public IP which is currently being used for the management interface. The provider has also assigned us a /29 block so our VMs can have public IPs. We can only use 1 physical NIC, which I think is causing some of the problems.

They have told us that the default gateway of the IPs from this block should be set to the IP of the ESXi server. Whenever we try to configure this, VMs complain saying that the gateway is in a different subnet, which it is.

They have indicated that because of the way their network is configured, we need to route any IPs from the block they assigned us through the IP of the ESXi server. From what I know, ESXi doesn't support routing, making this impossible.

We've asked if they can assign this block (or even a single IP) to the server so that they are the same as the ESXi IP so we can use them on VMs, but they have told us that their network setup does not allow for this.

Ideally, we want to be able to assign these public IPs to our VMs so that they are directly accessible from the internet. Is there a way to do this? Are we missing something?

If the above isn't possible, is there a way for us to do port-forwarding/anything else, so that we can reach our VMs from the internet?

We have not changed any networking configuration in ESXi, so we still have just a single vSwtich with both the management network and VM network attached to it. This vSwitch is attached to a single physical NIC on the server, which all IPs are assigned to.

Happy to provide any additional information if needed.

Best Answer

Your hosting provider (Hetzner, at a guess?) is correct.

You will need to assign the single static IP address to your VMware server's VMK interface. This will allow you to connect to the server via the VMware console and create VMs.

Your hosting provider should be able to route your /29 subnet to the server's MAC address.

You will also have a single vSwitch (I would personally rename this to "Public" for sanity) configured within vSphere, which is attached to your physical network card.

You will need to create a second vSwitch (for sanity, I recommend calling it "Private") which is not attached to any physical network interfaces.

Once these two vSwitches are set up, you can then create a virtual machine with two vNICs - one in each vSwitch. Use whatever "router" OS you like (typically something like ipfire or pfSense will do fine), and configure it to NAT packets between your WAN (Public) and LAN (Private) vSwitches.

To use your /29 IP addresses, you will need to create VMs attached to your Private vSwitch, and then NAT port-forward as necessary.

Related Topic