[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to "share" a public IP to a guest machine in VMware ESXi 4.1

Posted on 2011-03-24
Medium Priority
Last Modified: 2014-07-13
I am helping a fellow classmate with a lab project that involves VMware ESXi ver4.1, and his project is a little different than normal because he chose to setup his installation on a personal physical box and use a personal IP address that he has purchased from an ISP.

Usually we are working with private IP addresses, and we do not worry about making efficient use of this resource because they are free.

Overall, the big picture assignment is to create a firewall in the vm with 2 nics, that connects Vswitch0 to Vswitch1, and on Vswitch1, setup a Web Server and a Client Machine (xp, Fedora, or Chef's Suprise).

We need to be able to serve out a web page that our classmates can reach from the client machines on their VM (the Client previously mentioned on Vswitch1 behind the firewall).

Not worried about the routing issues, or the network for communication of our individual esx servers for the class. But this one student who has separated himself from the group has created an interesting challenge to solve. I see it as a very good opportunity to learn more about networking, and solve a very real world problem.

Sorry about all the extra info.............  anyway.....

This one particular esx server, which has been assigned the public ip, which is up, running, has vms created on it, and can be reached across the internet with vsphere.

The network card for the esx server is assigned the public IP address.

The vm firewall WAN interface running on that esx also needs to be assigned to the same public IP.

Is this possible through some kind of bridging? Or am I looking at this the wrong way?

Thank you very much in advance - Smizz.
Question by:Smizzong

Accepted Solution

mpilarczyk earned 400 total points
ID: 35211184
Install m0n0wall virtual appliance and publish web serwer through NAT.
LVL 12

Assisted Solution

by:Kent W
Kent W earned 400 total points
ID: 35211218
That's really going to depend on a lot of things.  Number one, what kind of connection is this, is it actually connected to his ISPs network, and is there anything other than, say, a cable modem in between the I'net and your ESXi?
If the ESXi box's main IP s the same as your Guest OS, you would have to use bridging.  The other choice is to use NAT.  Normally, you would setup a static, real-word IP inside the Guest OS, as you would a physical box.  You just assign a NIC to the guest OS, but set the IP parameters from within that install (ifconfig on Linux, Network Connections on Windows.  You also have virtual switch support...this post may help:


Assisted Solution

jimmyray7 earned 400 total points
ID: 35211221
If ESXi has the public IP, I don't think you can share that with a VM.  The easiest solution would be to put an inexpensive hardware router in front of the ESXi host and assign it the public IP, then use a private IP for the ESXi host.
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

LVL 16

Assisted Solution

by:Danny McDaniel
Danny McDaniel earned 800 total points
ID: 35212634
If you only have one public IP and the single nic that management and the VM Network have to go through, you're gonna have to do something like jimmyray7 suggested.  

If you've got a second nic, then you could keep the mgmt network on the private network and connect the VM network to the public side.

The only other thing I can think of, and it's not pretty, is to have the mgmt and vm network on the same vswitch, but...
-set the option for the VM to startup/shutdown with the host
-install the vsphere client inside of your webserver (it'll have to be running windows)
-assign a 2nd vmnic to the vm
-give the nic on the 2nd vmnic a private IP
-change the mgmt IP to an IP on the same private network.

Now, to manage the host, you're gonna have to log into the VM with RDP or VNC and run the vsphere client.

I've never tried anything like this but I think it will work.
LVL 16

Assisted Solution

by:Danny McDaniel
Danny McDaniel earned 800 total points
ID: 35212648
another option, if you have a second computer and a simple switch...

plug the public side and both computers into the switch.  use private static IP's on the 2nd computer and the ESXi mgmt network, leave the VM with the public IP or set to DHCP if that's how it's getting the public IP currently.  The 2nd computer won't be able to get to the internet unless you set up the 2nd nic on the web VM and do some kind of NAT or Internet Connection Sharing.  The 2nd computer is only there for mgmt of ESXi so it doesn't have to always be connected.

Author Closing Comment

ID: 35237867
All of these helpful solutions have merit, and have good points or ideas to consider......

It seems that ESX was designed to have a "management interface" - that must have it's own independent IP address, and then the vm's on the first/default vSwitch "0" will also be able to communicate on the same network segment (same network address range) as the the "real" physical network adapter of the host server (bare metal box).

In this case, the student decided to leave the public IP address assigned to the management interface, and used a "home based router/switch" which was assigned another separate public IP address. From this device, they served out an IP address to the virtual machine firewall WAN interface.

I guess the IP addresses that he has reserved from the ISP are just end of the line IP addresses. He does not actually have access to a default gateway address within his range of five IP's.

block of 5 ip's. eg.
All are valid public IP's that he accesses from a modem in a "pass through mode" with multiple ports, acting like a switch. He cannot actually set one statically as the IP on a router, and then specify a default gateway. He says he must setup the interface to accept DHCP to pull the IP address, and the DNS and DG are automatically set)

Thank you to all of you for your help and ideas. I am sure that it is obvious that I still have much to learn, but that is exactly what I intend to do.

Thanks again, and if you have any other ideas, or questions about all this stuff I just typed up, please post it. I will be back to check and follow up.

Expert Comment

ID: 40193369
Hello I have the same problem almost.

I have a dedicated server at kimsufi running esxi 5.0 with one ipv4 assigned to the management and I also have 1 public ipv6

I only have one physic nic

So im trying to get my VM's to access the internet

What is the solution here?

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
Teach the user how to rename, unmount, delete and upgrade VMFS datastores. Open vSphere Web Client: Rename VMFS and NFS datastores: Upgrade VMFS-3 volume to VMFS-5: Unmount VMFS datastore: Delete a VMFS datastore:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question