1

Pulling my hair for past few days over this. Can some VMWare ESXi expert help out?

I recently decided to give ESXi 5.5 a try. Installed it, got connected through vSphere client, and created few CentOS 6 VMs.

My ESXi configuration has all 3 CentOS6 guest VMs using the same vSwitch0:

My problem is only one of the VMs can get an automatic DHCP address, and hence can correctly connect to Internet. Rest of the VMs cannot get an IP address at all.

Is there any special setup required to allow guest VMs to get using the Internet?

I noticed that when I created the first VM, it was up and running, connected to Internet normally. When I installed second VM, trying to enable the network during CentOS install complained saying it cannot activate eth0. I did nothing extra, and this has stumped me for past few days.

Things I tried so far-

  1. Tried switching from ESXi 5 to ESXi 4 - same problem
  2. Tried enabling 'Promiscous mode' on vSwitch0's properties - same problem
  3. Tried a guest Windows VM - same problem, could not get IP

The ESXi hosts gets a dynamic DHCP assigned IP. I tried changing that to static, but nothing changes.

visitsb
  • 113
  • 1
  • 3
  • 2
    The DHCP address it's getting, where's that coming from (which DHCP server)? They're not hooked straight to an ISP getting public IPs, right? – Shane Madden Nov 22 '14 at 08:19
  • The physical box (host) is directly connected to outgoing internet. I want to use that box to run a hypervisor with a couple of VMs running intended for web development. – visitsb Nov 22 '14 at 09:13
  • I observe that if I turn on the VMs one by one, **only** the one that gets turned on first is able to get a DHCP assigned address. The later ones do not. – visitsb Nov 22 '14 at 09:15

2 Answers2

3

Your ISP connection will only assign a single public IP address to one of your systems, so the first one powered on gets that address.

You'll want a router which will provide NAT, allowing all of the machines to use the same public IP address. This could potentially be a piece of hardware, or another VM, a virtual router, running on that same VM host.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • Just curious - host gets one IP, and the first booted guest VM gets one IP (going through the host). Why is the case that rest of the guests cannot obtain their own IP addresses the same way? My intention behind going with ESXi was to be able to run multiple VMs, each one hooked up to Internet while going through host as a channel. – visitsb Nov 22 '14 at 10:01
  • @visitsb As to why you're able to get two IP addresses, that's a question only your ISP can answer - if you can get them to give you enough public addresses, you don't need NAT. Otherwise, you need a translation layer between limited public addresses and private addresses for each VM. NAT is that layer, and you'll need a router (either physical or virtual) to get it. – Shane Madden Nov 22 '14 at 10:13
  • Thanks Shane. I understand it must be NAT looking at Bobby's answer. – visitsb Nov 25 '14 at 02:36
0

I agree with Shane. You could try deploying a software router as a VM (like pfSense) and have it act as the NAT router for all of your VM's. The pfSense would have two interfaces, one on the external network/portgroup (the one that goes to your ISP) which would be configured as a DHCP client,and one on an internal VM network that would act as a DHCP server (you'd need to give this interface an IP like 192.168.100.1.) The pfSense would then be configured to act as a NAT router for all of your VM's. This should be a free simple fix for your issue.

In short, you'd have two port groups (VM, and external) with all the VM's on the VM network, and the pfSense with an interface on both the VM network and the external network.

Bobby
  • 16
  • I see. If this is the case, then I understand that each internal VM will use NAT to reach the Internet through the same external public IP as I configure. Is there absolutely no way to have different public IPs for each each VM within my current setup with current single public IP not touching or negotiating with ISP for additional static public IP addresses? My original intent was to have each VMs similar to having multiple separate physical machines. – visitsb Nov 24 '14 at 00:25
  • Thanks alot for the simplest explaination. It led me to [Configuring pfSense on ESXi 5](https://doc.pfsense.org/index.php/PfSense_2_on_VMware_ESXi_5) which will be my starting point. For now that will be my start, but I'd definitely like to know where I could find any information about this _peculiar_ behavior that has kept me occupied last week. – visitsb Nov 25 '14 at 02:38