vagrant
vagrant copied to clipboard
Windows 10, Hyper-v: Waiting for the machine to report its IP address... timeout
PS. I try with vagrant 2.1.15 and I have the same result.
PS. I change the timeout value to 10 minutes to 10 sec.. it doesn't change the result :(
PS F:\junk\05> vagrant -v
Vagrant 2.2.14
PS F:\junk\05>
C:\Users\survivant>ver
Microsoft Windows [version 10.0.21354.1]
C:\Users\survivant>
vagrant up
Bringing machine '2master' up with 'hyperv' provider...
Bringing machine '2worker1' up with 'hyperv' provider...
Bringing machine '2worker2' up with 'hyperv' provider...
==> 2master: Verifying Hyper-V is enabled...
==> 2master: Verifying Hyper-V is accessible...
==> 2master: Importing a Hyper-V instance
2master: Creating and registering the VM...
2master: Successfully imported VM
2master: Configuring the VM...
2master: Setting VM Enhanced session transport type to disabled/default (VMBus)
==> 2master: [Settings] [Network Adapter] Setting MAC address to: 00155D62F44A
Vagrant requires administrator access for pruning SMB shares and
may request access to complete removal of stale shares.
==> 2master: Starting the machine...
==> 2master: Waiting for the machine to report its IP address...
2master: Timeout: 60 seconds
Hyper-V failed to determine your machine's IP address within the
configured timeout. Please verify the machine properly booted and
the network works. To do this, open the Hyper-V manager, find your
virtual machine, and connect to it.
The most common cause for this error is that the running virtual
machine doesn't have the latest Hyper-V integration drivers. Please
research for your operating system how to install these in order
for the VM to properly communicate its IP address to Hyper-V.
PS F:\junk\05> vagrant status
Current machine states:
2master running (hyperv)
2worker1 not_created (hyperv)
2worker2 not_created (hyperv)
I'm able to connect to the VM and retreive the IP (it's the same as in the vagrantfile)
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.vm.define "2master" do |master|
master.vm.provider "hyperv" do |p|
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44A"
p.vmname = "2k8s-master"
end
master.vm.network "private_network", ip: "192.168.50.180", bridge: 'vagrant'
master.vm.hostname = "2k8s-master"
end
config.vm.define "2worker1" do |worker|
worker.vm.provider "hyperv" do |p|
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44B"
p.vmname = "2k8s-worker1"
end
worker.vm.network "private_network", ip: "192.168.50.181", bridge: 'vagrant'
worker.vm.hostname = "2k8s-worker1"
end
config.vm.define "2worker2" do |worker|
worker.vm.provider "hyperv" do |p|
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44F"
p.vmname = "2k8s-worker2"
end
worker.vm.network "private_network", ip: "192.168.50.182", bridge: 'vagrant'
worker.vm.hostname = "2k8s-worker2"
end
end
PS F:\junk\05> ipconfig
Configuration IP de Windows
Carte Ethernet VirtualBox Host-Only Network :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::5111:5094:fb78:d994%8
Adresse IPv4. . . . . . . . . . . . . .: 192.168.218.1
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . :
Carte Ethernet vEthernet (vagrant) :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::891d:2cbc:37d4:7a07%20
Adresse IPv4. . . . . . . . . . . . . .: 192.168.50.101
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . : 192.168.50.1
Carte inconnue Local Area Connection :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte réseau sans fil Local Area Connection* 3 :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte réseau sans fil Local Area Connection* 5 :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte Ethernet Ethernet 2 :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte Ethernet VMware Network Adapter VMnet1 :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::cd05:c9aa:65c:114a%29
Adresse IPv4. . . . . . . . . . . . . .: 192.168.112.1
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . :
Carte Ethernet VMware Network Adapter VMnet8 :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::dd87:d781:a75d:8cf0%23
Adresse IPv4. . . . . . . . . . . . . .: 192.168.65.1
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . :
Carte Ethernet Bluetooth Network Connection :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte Ethernet Network Bridge :
Statut du média. . . . . . . . . . . . : Média déconnecté
Suffixe DNS propre à la connexion. . . :
Carte Ethernet vEthernet (Default Switch) :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::f1a9:5dcf:c4f3:4087%32
Adresse IPv4. . . . . . . . . . . . . .: 172.25.144.1
Masque de sous-réseau. . . . . . . . . : 255.255.240.0
Passerelle par défaut. . . . . . . . . :
Carte Ethernet vEthernet (WSL) :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::803a:f4c6:bab0:9732%41
Adresse IPv4. . . . . . . . . . . . . .: 172.21.48.1
Masque de sous-réseau. . . . . . . . . : 255.255.240.0
Passerelle par défaut. . . . . . . . . :
PS F:\junk\05>
I can run vagrant up 3 times.. and all my VM will be created at the end.. but I'm not sure which steps will be missing.
here my virtual swtich vagrant
if I change the config for
config.vm.define "2worker1" do |worker|
worker.vm.provider "hyperv" do |p|
p.ip_address_timeout = 60
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44B"
p.vmname = "2k8s-worker1"
end
worker.vm.network "private_network", ip: "192.168.50.181"
worker.vm.hostname = "2k8s-worker1"
end
I'll obtain this for the worker2
==> 2worker1: Verifying Hyper-V is enabled...
==> 2worker1: Verifying Hyper-V is accessible...
==> 2worker1: Importing a Hyper-V instance
2worker1: Creating and registering the VM...
2worker1: Successfully imported VM
2worker1: Please choose a switch to attach to your Hyper-V instance.
2worker1: If none of these are appropriate, please open the Hyper-V manager
2worker1: to create a new virtual switch.
2worker1:
2worker1: 1) vagrant
2worker1: 2) Default Switch
2worker1: 3) WSL
2worker1:
2worker1: What switch would you like to use? 2
2worker1: Configuring the VM...
2worker1: Setting VM Enhanced session transport type to disabled/default (VMBus)
==> 2worker1: [Settings] [Network Adapter] Setting MAC address to: 00155D62F44B
==> 2worker1: Starting the machine... ==> 2worker1: Waiting for the machine to report its IP address... 2worker1: Timeout: 60 seconds 2worker1: IP: 172.25.152.108 ==> 2worker1: Waiting for machine to boot. This may take a few minutes... 2worker1: SSH address: 172.25.152.108:22 2worker1: SSH username: vagrant 2worker1: SSH auth method: private key 2worker1: 2worker1: Vagrant insecure key detected. Vagrant will automatically replace 2worker1: this with a newly generated keypair for better security.
2worker1:
2worker1: Inserting generated public key within guest...
2worker1: Removing insecure key from the guest if it's present...
2worker1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> 2worker1: Machine booted and ready!
==> 2worker1: Preparing SMB shared folders...
Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> 2worker1: Setting hostname...
==> 2worker1: Mounting SMB shared folders...
2worker1: F:/junk/05 => /vagrant
but the IP if not the right one
I can do that to and vagrant will find the IP and mount the SMB share
config.vm.define "2worker2" do |worker|
worker.vm.provider "hyperv" do |p|
p.ip_address_timeout = 60
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44F"
p.vmname = "2k8s-worker2"
end
worker.vm.network "private_network", ip: "192.168.50.182", bridge: 'Default Switch'
worker.vm.hostname = "2k8s-worker2"
end
I found that I can create the VM with "Default Switch" and after change the switch to "vagrant" and reboot. The VM will works but the SMB share folder is not mount anymore.
there is a workaround for the SMB. I can use add a line in /etc/fstab to mount it followed by sudo mount -a
Hyper-V networking is still pretty much non-existent vagrantup.com/docs/providers/hyperv/limitations, you can only really get a dynamic IP from DHCP.
A result of this is that networking configurations in the Vagrantfile are completely ignored with Hyper-V. Vagrant cannot enforce a static IP or automatically configure a NAT
I've tried to get some more discussion going here on this discussion ticket from 2017 because I've been wanting the same thing and got a PoC going https://github.com/hashicorp/vagrant/issues/8384