无业游民未遵循无业游民文件中的静态IP定义

时间:2019-09-04 22:12:53

标签: vagrant vagrantfile vagrant-windows

游民版本: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地址,即使它与现有范围重叠(如文档所示!)

我从来没有遇到过流浪汉的问题,但是再说一次,我再也不需要静态地分配地址了……

任何帮助调查/解释发生了什么事,将不胜感激!

1 个答案:

答案 0 :(得分:0)

ip: "172.18.72.210"是公共IP-您需要从Private Network中选择一个IP,也许您想将其设置为172.16.72.210

相关问题