-1

I've got 2 network cards on my Linux host machine. eth0 is flaky, so I don't use it (ifconfig eth0 down). eth1 is set up for DHCP.

In my Vagrantfile, I have

  config.vm.network :private_network, type: 'dhcp'

This works. Sort of. The windows guest machine comes up with working networking on "Ethernet 2". It also has an inactive "Ethernet" connection. But I get an error on vagrant up, and it doesn't run my Chef recipes. The vagrant error is

==> 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:

I've tried config.vm.network :private_network, type: 'dhcp', adapter: '2'

but that gives

 undefined method '+' for nil:NilClass (NoMethodError) 

from a call stack of

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'
LOS
  • 523
  • 4
  • 6

1 Answers1

1

from 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
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139