我想设置多个虚拟机,并使用一个以上的private_network IP。我使用Debian9作为主机系统。我的Vagrant版本是发行版中的“ Vagrant 2.0.2”。我使用的盒子也是Debian9。我创建了一个具有以下内容的Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "cluster01"
config.vm.define "node1" do |node1|
config.vm.synced_folder "./data/", "/data/"
config.vm.network "private_network", ip: "192.168.56.21"
config.vm.network "private_network", ip: "192.168.57.21"
config.vm.hostname = "node1"
end
config.vm.define "node2" do |node2|
config.vm.synced_folder "./data/", "/data/"
config.vm.network "private_network", ip: "192.168.56.22"
config.vm.network "private_network", ip: "192.168.57.22"
config.vm.hostname = "node2"
end
end
当我“无所事事”时,机器将启动。第一台机器的网卡设置正确:
==> node1: Preparing network interfaces based on configuration...
node1: Adapter 1: nat
node1: Adapter 2: hostonly
node1: Adapter 3: hostonly
但是第二台机器有4个专用网卡:
==> node2: Preparing network interfaces based on configuration...
node2: Adapter 1: nat
node2: Adapter 2: hostonly
node2: Adapter 3: hostonly
node2: Adapter 4: hostonly
node2: Adapter 5: hostonly
在第二个节点上,我有两个IP地址为192.168.56.22的NIC和两个IP地址为192.168.57.22的NIC。对于这种配置,我找不到任何好的解释。我做错了什么?