我的Linux主机上有2张网卡。 eth0是片状的,所以我不使用它(ifconfig eth0 down)。 eth1设置为DHCP。
在我的Vagrantfile中,我有
config.vm.network :private_network, type: 'dhcp'
这很有效。有点。 Windows客户机在"以太网2"上提供了工作网络。它还有一个不活动的以太网"连接。但是我在流浪汉上得到了一个错误,它并没有运行我的厨师食谱。流浪错误是
==> win10: Configuring and enabling network interfaces...
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
netsh interface ip set address "Ethernet 2" dhcp
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }
Stdout from the command:
Stderr from the command:
我已经尝试过了 config.vm.network:private_network,输入:' dhcp',适配器:' 2'
但是这给了
undefined method '+' for nil:NilClass (NoMethodError)
来自
的调用堆栈blah/configure_networks.rb:25:in `each'
blah/configure_networks.rb:25:in `configure_networks'
blaah/lib/vagrant/capability_host.rb:111:in `call'
blaah/lib/vagrant/capability_host.rb:111:in `capability'
答案 0 :(得分:1)
Vagrant.configure("2") do |config|
config.vm.network "private_network", auto_config: false
# manual ip
config.vm.provision "shell",
run: "always",
inline: "ifconfig eth1 192.168.0.17 netmask 255.255.255.0 up"
end