Hyper-V / Networking question

Chiefcrowe

Diamond Member
Sep 15, 2008
5,056
199
116
So I have a VM currently that has a private IP address but I want it to also have a Public IP.

How do I set up the Host Server so that a spare NIC card that I connect to a public subnet will pass through and communicate directly with the guest VM?

thanks!
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
give the VM an extra NIC so it has two. Set the new NIC up with the public IP and leave the first NIC with the private IP.

Make sure the public NIC is using an external switch in Hyper-V so its bridged directly to the WAN.

the external switch will have to be bound to the host NIC connected to the public subnet.

*mobile post
 

Chiefcrowe

Diamond Member
Sep 15, 2008
5,056
199
116
Thanks. how do I set up the external switch? Haven't had to do that before since all the other VMs are internal.
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
open the Hyper-V management console

select Switch Management

Create new switch

choose external

Select the NIC which is connected to the WAN

if you need to access the host from that NIC leave the box checked to allow host access.

Create the switch.

then in the settings panel of the VM you are configuring. Click on network adapters. Select the adapter you want to be connected to the WAN. Choose the switch you just created to give it connectivity.

*writing on my mobile so I don't have access to a PC, so that's just off the top of my head.

good luck :)
 

Chiefcrowe

Diamond Member
Sep 15, 2008
5,056
199
116
Thank you. How are the TCP/IP settings of the host NIC configured typically?

I'm not exactly sure where the static address needs to be set or if it needs be on both the Host and Guest?
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
For example if you have 2 network cards.

NIC #1 = Host Network/Management Network
- Give this a static IP address which will be the hosts primary IP and what you will use to connect using remote desktop and so on.

NIC #2 = VM Network, used only for virtual machine traffic:
- Setup in the way i explain above
- Do not set a static IP on this interface
- After you have created a Virtual Switch in Hyper-v bound to this adapter look under Network Connections on the host, right click the adapter and select properties. You will notice that the only box checked is Hyper-V Extensible Virtual Switch. TCP/IP and the rest are unchecked - This is how it is meant to be. No IP will be set on this interface.

Now the only thing you have to remember to do when creating a VM which will have direct WAN access is to make sure it's connected to the virtual switch you created which is in turn bound to the 2nd Network card attached to the WAN.

Now forget about the host. Forget about the host network cards. You will setup every new VM as if it was a physical machine. As long as it's connected to the WAN network switch you can give the guest any of your WAN IPs and it will have connectivity.