Search code examples
sshtimeoutvagrant

Vagrant up fails with multiple private networks


I am able to create a box with one private network but when I add more than one private network, it doesn't come up.

Vagrantfile:

Vagrant.configure("2") do |c|
  c.vm.box = "bento/centos-7.3"
  c.vm.box_url = ""
  c.vm.hostname = "default-centos-7.vagrantup.com"
    c.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", ip: "192.100.2.10"
    c.vm.network(:private_network, {:ip=>"192.100.2.15"})
    c.vm.network(:private_network, {:ip=>"192.100.2.16"})
    c.vm.network(:private_network, {:ip=>"192.100.2.17"})
  end
  c.vm.synced_folder "../../../", "/vagrant"
  c.vm.provider :virtualbox do |p|
  end
end

It doesn't give any error but times out on adding the ssh key.

==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

What am I missing here?


Solution

  • I changed the ips to 10.x.x.x values and it came up. I am not sure why vagrant couldnt use those particular ips mentioned in the question though.