Vagrant不允许适配器1上的NatNetwork

Vagrant不允许适配器1上的NatNetwork,vagrant,virtualbox,Vagrant,Virtualbox,Vagrant正在适配器1(eth0)上强制网络类型nat,即使我在VirtualBox中将网络设置为natnetwork。 我可以通过Virtualbox手动设置所有内容,我的所有虚拟机都可以根据需要通过eth0相互通信,端口转发也可以工作。我想让流浪汉以同样的方式工作,以便在同事之间分配 看起来其他人也有这个问题,流浪汉没有解决这个问题: 有人知道解决办法吗 详细信息: $ VBoxManage list natnetworks NetworkName: ff_mgmt IP:

Vagrant正在适配器1(eth0)上强制网络类型
nat
,即使我在VirtualBox中将网络设置为
natnetwork

我可以通过Virtualbox手动设置所有内容,我的所有虚拟机都可以根据需要通过eth0相互通信,端口转发也可以工作。我想让流浪汉以同样的方式工作,以便在同事之间分配

看起来其他人也有这个问题,流浪汉没有解决这个问题:

有人知道解决办法吗

详细信息:

$ VBoxManage list natnetworks
NetworkName:    ff_mgmt
IP:             10.0.2.1
Network:        10.0.2.0/24
IPv6 Enabled:   No
IPv6 Prefix:    fd17:625c:f037:2::/64
DHCP Enabled:   No
Enabled:        Yes
Port-forwarding (ipv4)
    https1:tcp:[]:4441:[10.0.2.11]:443
    https2:tcp:[]:4442:[10.0.2.12]:443
    https3:tcp:[]:4443:[10.0.2.13]:443
    ssh1:tcp:[]:2221:[10.0.2.11]:22
    ssh2:tcp:[]:2222:[10.0.2.12]:22
    ssh3:tcp:[]:2223:[10.0.2.13]:22
loopback mappings (ipv4)
    127.0.0.1=2
流浪汉档案的相关部分

boxes = [
{
    :name => "ff1",
    :ip => "10.0.2.11",
    :ssh_port => "2221",
    :https_port => "4441",
    :mac =>  "0800270fa302",
    :memory => "8192",
    :cpus => "4"
},
{
    :name => "ff2",
    :ip => "10.0.2.12",
    :ssh_port => "2222",
    :https_port => "4442",
    :mac =>  "0800270fb302",
    :memory => "8192",
    :cpus => "4"
},
{
    :name => "ff3",
    :ip => "10.0.2.13",
    :ssh_port => "2223",
    :https_port => "4443",
    :mac =>  "0800270fc302",
    :intnet2 => "seg5a",
    :memory => "8192",
    :cpus => "4"
}
]

Vagrant.configure(2) do |config|
boxes.each do |opts|
    config.vm.define opts[:name] do |config|

        config.vm.box = "ff"
        #config.vm.box_version = 402

        config.vm.hostname = opts[:name]

        config.ssh.username = 'niska'
        config.ssh.private_key_path = '/home/niska/.ssh/id_rsa'
        config.vm.network :private_network, ip: opts[:ip]
        config.vm.network :forwarded_port, guest: 22, guest_ip: opts[:ip], host: opts[:ssh_port], id: 'ssh'
        config.vm.network :forwarded_port, guest: 443, host: opts[:https_port]

        config.vm.provider "virtualbox" do |vb|
            vb.gui = false
            vb.memory = opts[:memory]
            vb.cpus = opts[:cpus]

            vb.customize ["modifyvm", :id, "--nic1", "natnetwork"]
            vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
            vb.customize ["modifyvm", :id, "--macaddress1", opts[:mac]]
            #vb.customize ["modifyvm", :id, "--intnet1", "ff_mgmt"]

        end
    end
end
vagrant up的输出
。请注意,
natnetwork
的覆盖。端口转发也会选择不同的端口,因此无法连接

$ vagrant reload ff1
==> ff1: Attempting graceful shutdown of VM...
    ff1: Guest communication could not be established! This is usually because
    ff1: SSH is not running, the authentication information was changed,
    ff1: or some other networking issue. Vagrant will force halt, if
    ff1: capable.
==> ff1: Forcing shutdown of VM...
==> ff1: Clearing any previously set network interfaces...
==> ff1: Preparing network interfaces based on configuration...
->>>     ff1: Adapter 1: nat                       <<<--- (overrode w/ 'nat')
    ff1: Adapter 2: hostonly
==> ff1: Forwarding ports...
    ff1: 22 (guest) => 2221 (host) (adapter 1)
    ff1: 443 (guest) => 4441 (host) (adapter 1)
==> ff1: Running 'pre-boot' VM customizations...
==> ff1: Booting VM...
==> ff1: Waiting for machine to boot. This may take a few minutes...
    ff1: SSH address: 127.0.0.1:22
    ff1: SSH username: niska
    ff1: SSH auth method: private key
    ff1: Warning: Authentication failure. Retrying...
    ...
    Vagrant never connects
$vagrant重新加载ff1
==>ff1:正在尝试正常关闭VM。。。
ff1:无法建立来宾通信!这通常是因为
ff1:SSH未运行,身份验证信息已更改,
ff1:或者其他一些网络问题。如有必要,流浪汉将强制停车
ff1:有能力。
==>ff1:强制关闭虚拟机。。。
==>ff1:清除以前设置的任何网络接口。。。
==>ff1:根据配置准备网络接口。。。
->>>ff1:适配器1:nat 4441(主机)(适配器1)
==>ff1:正在运行“预引导”VM自定义。。。
==>ff1:正在启动VM。。。
==>ff1:正在等待机器启动。这可能需要几分钟。。。
ff1:SSH地址:127.0.0.1:22
ff1:SSH用户名:niska
ff1:SSH身份验证方法:私钥
ff1:警告:身份验证失败。重试。。。
...
流浪汉从不联系
不要将nic1(eth0)设置为NAT以外的任何值。virtualbox要求第一个接口是NAT

ff1: Warning: Authentication failure. Retrying...
如果您将nic的网络类型更改为natnetwork,则vagrant无法了解如何使用ssh连接到机器

如果您首先需要vagrant设置,请在完成设置后更改网络设置。然而;之后,您将无法使用vagrant。

不要将nic1(eth0)设置为NAT以外的任何值。virtualbox要求第一个接口是NAT

ff1: Warning: Authentication failure. Retrying...
如果您将nic的网络类型更改为natnetwork,则vagrant无法了解如何使用ssh连接到机器


如果您首先需要vagrant设置,请在完成设置后更改网络设置。然而;在此之后,您将无法使用vagrant。

声明nic1必须是NAT适配器。我不熟悉VirtualBox中
natnetwork
nat
之间的区别,只是我知道前者是新的。也许流浪汉也没有意识到这种差异?声明nic1必须是NAT适配器。我不熟悉VirtualBox中
natnetwork
nat
之间的区别,只是我知道前者是新的。也许Vagrant也没有意识到这一点?我希望找到一个解决办法,而不是“不要那样做”:)我最终切换到vmware和Vagrant,这两种产品一起可以解决这个问题。我希望找到一个解决办法,而不是“不要那样做”:)我最终切换到vmware和Vagrant,这两种产品结合在一起可以解决这个问题