How to fix IP for Vagrant under Hyper-V?

The network Settings in the Vagrantfile configuration file do not work in Hyper-V environment.How can I fix Vagrant IP?Otherwise every time I reboot the computer Vagrant up will cause Vagrant IP to change.

Moved to the Vagrant section. :wink:

I was able to FIX the MAC address for the second NIC I added. So this way I always get the same “Reservation” from DHCP.
I didn’t try to fix the IP address.

I have achieved this using Open DHCP Server Windows/Linux download | SourceForge.net and some powershell scripts that manage it. I am not sure whether it’s the right path to go , or whether it’s fine to add it as a dependency but it works pretty well without any bugs. If you are interested, i could spend some time adding it into a fork.

The advantage is that it can be used for any Win/Linux box, since they all ask for an IP address via DHCP

What it does is :

  1. create internal switch (using a naming scheme which involves the machine name, so it is possible to keep track of it)
  2. write the info in the OpenDHCP INI file (hyper-V will give the VM some MAC address, it is possible to retrieve it at run-time using powershell. Using the MAC address it is possible to let the DHCP server know it’s supposed to assign a specific IP address to it)
  3. start the dhcp server on the host endpoint of this internal switch (it runs as a service)