【发布时间】:2020-01-07 19:27:07
【问题描述】:
流浪者版本:2.2.5 提供者:Hyper-V 操作系统:Windows 10、1809
在我的 vagrantfile 中指定一个 ipv4 地址后,在使用“vagrant up”时它不会分配它,它会分配另一个地址
我尝试将地址更改为不同的范围,使用不同的适配器等,但它仍然不遵守 Vagrantfile 中指定的内容。
流浪文件:
Vagrant.configure("2") do |config|
config.vm.define "kube-1" do |ctl|
ctl.vm.box = "generic/ubuntu1804"
ctl.vm.hostname = "kube-1"
ctl.vm.network "private_network", ip: "172.18.72.210", bridge: "Default Switch"
ctl.vm.synced_folder ".", "/vagrant", disabled: true
ctl.vm.provider "hyperv" do |vb|
vb.memory = 2048
vb.cpus = 2
end
end
end
输出:
Bringing machine 'kube-1' up with 'hyperv' provider...
==> kube-1: Verifying Hyper-V is enabled...
==> kube-1: Verifying Hyper-V is accessible...
==> kube-1: Importing a Hyper-V instance
kube-1: Creating and registering the VM...
kube-1: Successfully imported VM
kube-1: Configuring the VM...
==> kube-1: Starting the machine...
==> kube-1: Waiting for the machine to report its IP address...
kube-1: Timeout: 120 seconds
kube-1: IP: 172.18.72.197
==> kube-1: Waiting for machine to boot. This may take a few minutes...
kube-1: SSH address: 172.18.72.197:22
kube-1: SSH username: vagrant
kube-1: SSH auth method: private key
kube-1: Warning: Remote connection disconnect. Retrying...
kube-1:
kube-1: Vagrant insecure key detected. Vagrant will automatically replace
kube-1: this with a newly generated keypair for better security.
kube-1:
kube-1: Inserting generated public key within guest...
kube-1: Removing insecure key from the guest if it's present...
kube-1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> kube-1: Machine booted and ready!
==> kube-1: Setting hostname...
我原以为它会查看 Vagrantfile(根据文档)并分配我指定的 IP 地址,即使它与现有范围重叠(正如文档所建议的那样!)
我从来没有遇到过 vagrant 的问题,但话又说回来,我从来不需要静态分配地址……叹息!
任何帮助调查/解释正在发生的事情将不胜感激!
【问题讨论】:
标签: vagrant vagrantfile vagrant-windows