1

I've recently had to move from the Linux/libvirt world to a Windows 10 Pro system utilizing HyperV machine for some testing, and frankly don't know what I'm doing.

I have a CentOS virtual machine completely set up and working in HyperV, accessible via the HyperV Manager. What I'd like to do is ensure it has a static IP address assigned to it at boot when it performs DHCP. Currently, it is assigned whatever the internal Vswitch's DHCP server decides it should get.

In libvirt, I'd set up a configuration for the virtual machine's network to perform DHCP reservations. I'd provide it the MAC address of the VM, and on boot the DHCP server would always assign the IP I indicated, making it easy to set up static DNS records to reach that VM from the host.

I don't seem to be able to do that from Windows 10 Pro HyperV. If I select "Virtual Switch Manager" in the HyperV Manager, I get options for the switch, but nothing about DHCP reservations. Similarly in the VM Guest's settings, I see nothing allowing for reservations, but maybe I missed something.

Is this functionality that Windows HyperV has for the internal DHCP servers on VSwitches? I know I can statically assign an IP address in the virtual NAT'd network I have set up by default, but I'd prefer not to, as I am going to roll out a bunch of guests and it'd be much cleaner to just pre-define their MAC's and have them "automagically" connect. Thanks!

2
  • See if anything in this article helps>>>>docs.microsoft.com/en-us/windows-server/networking/technologies/…
    – Moab
    Commented Apr 8, 2020 at 16:22
  • @Moab the only thing this references about DHCP Reservations is a definition, no steps or anything particular to setting up HyperV's VSwitch to make reservations. While I appreciate the help, this article appears to be more generically assuming of definitions of DHCP and how DHCP works overall. I don't seem to have the PowerShell cmdlets of Get-DhcpServer* either, unfortunately, so I can't modify any existing servers, and I don't think this is the DHCP server type they utilize for VSwitch. Thank you!
    – robbmanes
    Commented Apr 8, 2020 at 16:31

1 Answer 1

2

My understanding is that you have two requirements, that at least on Hyper-V are conflicting:

  • Static IP, I assume so that the VMs may communicate between them.
  • Internet access, which is impossible when you drop the VMs into another network.

Hyper-V does not have the concept of static IP, only static MAC, which does not help.

The solution would be to give the VMs two NICs, one for the static IP and another for dynamic IP and internet access in the target network.

There are two points to remember:

  • The static IP address has to be assigned to the VM's first NIC.
  • The virtual NICs have a dependency on an underlying virtual switch by name.

The second point is the hard one. if you export a Hyper-V VM and import it into a different host on a different network, the new host will probably use a different physical NIC, and any existing virtual switch may have a different name from yours.

There are two possible solutions here:

  • Create an identically named virtual switch on the destination host before importing the VM.

  • Find ahead of time the name of the destination host's virtual switch and create an identically named virtual switch in your own lab for use by the VMs.

1
  • While I don't like the answer and think of it as a severe limitation to HyperV which prevents a lot of functionality, I greatly appreciate the effort put into your reply. Thanks!
    – robbmanes
    Commented Apr 8, 2020 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .