Vagrant + Hyper V IPV6 addresses Assigned

1.4k views Asked by At

I have been having a lot of troubles with Vagrant 2.0.1 on Windows 10 with Hyper V.

When I do vagrant up I receive an ipv6 address. Which chef can't access and fails to provision the virtual:

Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Configured startup memory is 2048
==> default: Configured cpus number is 2
==> default: Importing a Hyper-V instance
    default: Cloning virtual hard drive...
    default: Creating and registering the VM...
    default: Setting VM Integration Services
    default: Successfully imported a VM with name: vargrant-dev-source
==> default: Installing Chef cookbooks with Librarian-Chef...
==> default: Auto-generating node name for Chef...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: fe80::215:5dff:fe02:f5a
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: fe80::215:5dff:fe02:f5a:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    ... Eventually times out here ....

I used the following commands to set up a NATed switch:

New-VMSwitch –SwitchName “NATSwitch” –SwitchType Internal
New-NetIPAddress –IPAddress 172.21.21.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNat –Name MyNATnetwork –InternalIPInterfaceAddressPrefix 172.21.21.0/24

Interestingly everything works the first time I set up the VM switch and I get a valid IPV4 address and things are okay. But after I reboot the virtual machines will only ever get IPV6 addresses and I cant access existing ones created before the reboot.

My vagrant file:

Vagrant.configure("2") do |config|

  config.vm.provider "hyperv"
  config.vm.box = "maxx/ubuntu16"
  config.vm.boot_timeout = 2000
  config.vm.network "private_network", ip: "172.21.21.2"

  ... general config omitted.

end

I have tried both DHCP and static and both seem to fail. With static IP seemingly ignored completely.

Any ideas what I'm missing or doing wrong? (I am using a wifi connection if that is relevant)

1

There are 1 answers

1
Rtype On BEST ANSWER

I found a way around it by using internet connection sharing between my wifi and the virtual hyper v network. But currently, there is a bug in windows build 1607 where internet connection sharing needs to be restarted after every reboot.

A large thread here on the MS forums: https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/ics-internet-connection-sharing-dosent-work-in/a203c90f-1214-4e5e-ae90-9832ae5ceb55