Link to home
Start Free TrialLog in
Avatar of gopher_49
gopher_49

asked on

ESXi - IP passthrough to virtual machine

I installed a NIC that will be a dedicated WAN interface.  This NIC will be assigned a public IP address via my ISP.  I want this IP address to be bound to a NIC on a VM.  I only have 1 x VM in the virtual switch group/port.  I also only have 1 NIC assigned to it...  How can I do this?  I'm trying to setup a virtual firewall/router.
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

either connect that physical nic on the ESXi server to your Inbound Router.

create a vSwitch, add the physical nic, create a virtual machine portgroup, select this portgroup in the Interface Settings.

Add public ip address to VM
you should create a second vswitch and assign the physical nic to it. then assign the vm nic to that  vswitch.
don't assign that IP to the VMware NIC, assign it directly to the VM
Avatar of gopher_49
gopher_49

ASKER

What if my IP address changes?  It will run for months without it changing but it could change one day...  I've done everything mentioned except add the IP address given to me to my VM...  I guess I'll give it a shot...But..  The WAN interface on the VM would drop whenever my public IP changes.
IP Address changes?

what your External Public IP Address is DHCP?

Most public external IP addresses, I know of our Static for WANs?

Does your ISP, issue the IP Address via DHCP?

if so, setup as DHCP, DHCP will request it from their servers.

you could look at Smoothwall v3.

http://www.smoothwall.org/

Not sure, what you are wanting to do, what services you are running etc
same as any other dynamic network client, configure dhcp on the interface of the vm.
This is for a lab on a home network using Comcast... Comcast issues the public IP via DHCP.  So, my dedicated physical NIC on the ESXi host will get this IP address.  It's a public IP address and stays the same for months.. But eventually does change.  So, since this public IP is issued via DHCP then I need to bind this assigned IP address to my VM.  I want my VM to have the same IP for it will be an outside interface for a virtual firewall/router.
This will not work. IP Address of the ESXi host is dictated by MAC Address.

Every NIC has a different MAC address, so your VM cannot share the same MAC Address/TCP IP address as the host.

Do you only have a single NIC?

if you have a single NIC, you will need to use NAT, and forward requests from Public IP Address at Router via NAT to Internal VMs.

You are going to need a Virtual Router, which offers NAT, or Port Forward NAT from your router to your VMs.
either the vm or the host will have the ip not both. really if you read the first 2 posts  you will get it working.

do not assign an ip to the interface on the esx host, just assign the nic to a vswitch and let the vm get the ip.
okay.. Let's start over...  

I have two physical NICS, two virtual switch groups, and two port groups...  The second virtual switch group has one VM and one physical NIC assigned to it.  The physical NIC has a public IP via DHCP from Comcast.. Now, how can I get that public IP to pass to my VM?  Someone mentioned assigning the VM NIC to this IP, however, then you would have one IP with two different mac addresses which is sketchy.. I'm thinking I'll have to perform NAT from the DHCP assigned public IP to my VM's IP, correct?
djcanter,

I don't understand your post.  How can I make it where the ESXi host doesn't get the IP?  The dedicated physical NIC is plugged into the router.  How can I bypass nic NIC for the ESXi host and only assign to a VM?
no nat. dont configure an ip on the interface.
Okay, two physical NICs fine.

Create a new vSwitch1, see my first post!

ESXi 1st NIC has an IP Address on your LAN- vswitch0 - vmnic0

VM has an IP Address assigned by DHCP from your ISP! -vSwitch1 - vmnic1 -- router -- ISP
djcanter,

I've already done what you said.  The dedicated physical nic is not assigned on the ESXi console as a management NIC.  I added it via the vSphere client.  I assigned it to a dedicated switch port group within a dedicated vswitch.  The only VM in this group is my firewall VM.. But..  When I added the NIC via vsphere it asked whether it's static or DHCP.. So, at that point it already grabbed an IP.
hanccocka,

When I added the NIC and assigned it via vSphere it was set to DHCP.  So it already grabbed an IP address prior to the VM even being in the picture.  I've done everything you said but the IP is assigned to the physical nic prior to VM's even being assigned to that port group.
I dont know where in vsphere it would ask if the physical nic was dhcp or static uless it was bound to a management interface.
 
can you screenshot your config/networking tab.
vswitch.JPG
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe I didn't create a vSwitch.  I'll check when I get back to the home network and update the ticket...  But..  If I assign a physical NIC to a vSwitch and since I only have 1 x VM in this portgroup then that VM will get the DHCP issued IP, correct?  This is what I thought I did last night but I must of created a VMKernel instead for it assigned the IP to the physical NIC.

I bet that's what happened.  I'll check it out when I get to the network.

Thanks.
correct. let us know.
Check what you select!

and make sure you have a good firewall if hanging a Windows box with a public IP!
I'm using an Endian firewall which is Linux based.
hanccocka,

You're correct.  I had the VM in a KMkernel port versus a Virtual Machine Port Group?!  I love this Endian firewall.  I now have a true outside interface and inside interface.  Having a virtual machine based firewall makes my network so diverse for nothing in cost.

Thanks!