首页 文章

2个网卡的流浪网络错误(1个无效)

提问于
浏览
-1

我的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',adapter:'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'

1 回答

  • 1

    来自vagrant networking doc

    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
    

相关问题