all remote ssh connections are being reset when I vagrant up another vm

93 views
Skip to first unread message

rus...@infinite.io

unread,
Aug 10, 2016, 6:09:52 PM8/10/16
to Vagrant
Ubuntu Desktop 16.4
Vagrant 1.8.5
VMware Workstation 12 Pro

I have multiple VMs running (guests are Ubuntu servers) and I have each of them with different forwarded ssh and https ports (of course).
ssh and https to each remotely works fine until i bring another VM up and ALL the forwarded port connections are reset.  
For example: I vagrant up 3 VMs and then SSH into each of them.  I vagrant up the fourth and all connections to first 3 are killed.  This is causing a lot of problems for the developers I'm supporting.  Any ideas?


Vagrantfile

boxes = [
  {
    :name => "ff1",
    :ssh_port => "2221",
    :https_port => "4441"
  },
  {
    :name => "ff2",
    :ssh_port => "2222",
    :https_port => "4442"
  },
  {
    :name => "ff3",
    :ssh_port => "2223",
    :https_port => "4443"
  }
]

Vagrant.configure(2) do |config|
  boxes.each do |opts|
    config.vm.define opts[:name] do |config|

      config.vm.network :forwarded_port, guest: 22, host: opts[:ssh_port], id: 'ssh'
      config.vm.network :forwarded_port, guest: 443, host: opts[:https_port]

      config.vm.provider "vmware_workstation" do |v|
<snip>


SSH into the boxes from my mac like so:

or http:

Bring up one of the boxes:
$ vagrant up ff1
Bringing machine 'ff1' up with 'vmware_workstation' provider...
==> ff1: Verifying vmnet devices are healthy...
==> ff1: Preparing network adapters...
==> ff1: Starting the VMware VM...
==> ff1: Waiting for machine to boot. This may take a few minutes...
    ff1: SSH address: 172.16.136.153:22
    ff1: SSH username: niska
    ff1: SSH auth method: private key
    ff1: Warning: Host unreachable. Retrying...
    ff1: Warning: Host unreachable. Retrying...
    ff1: Warning: Host unreachable. Retrying...
==> ff1: Machine booted and ready!
==> ff1: Forwarding ports...
    ff1: -- 22 => 2221
    ff1: -- 443 => 4441
==> ff1: Setting hostname...
==> ff1: Configuring network adapters within the VM...
==> ff1: Waiting for HGFS to become available...
==> ff1: Enabling and configuring shared folders...
    ff1: -- /home/niska/boxes/ff: /vagrant
==> ff1: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> ff1: flag to force provisioning. Provisioners marked to run always will still run.

Alvaro Miranda Aguilera

unread,
Aug 11, 2016, 2:33:01 AM8/11/16
to vagra...@googlegroups.com

On Thu, Aug 11, 2016 at 12:09 AM, <rus...@infinite.io> wrote:
Vagrant.configure(2) do |config|
  boxes.each do |opts|
    config.vm.define opts[:name] do |config|

      config.vm.network :forwarded_port, guest: 22, host: opts[:ssh_port], id: 'ssh'
      config.vm.network :forwarded_port, guest: 443, host: opts[:https_port]

      config.vm.provider "vmware_workstation" do |v|
<snip>

Hello,

Whats the output of

vagrant ssh-config <box> after you start the 2nd one?


I think should be like this:

Vagrant.configure(2) do |config|
  boxes.each do |opts|
    config.vm.define opts[:name] do |opts[:name]|

      opts[:name].vm.network :forwarded_port, guest: 22, host: opts[:ssh_port], id: 'ssh'
      opts[:name].vm.network :forwarded_port, guest: 443, host: opts[:https_port]

      opts[:name].vm.provider "vmware_workstation" do |v|
<snip>

If you want the provider vmware... to be global, take it out of the define block and use it as config.vm.provider.

Can you test?

Alvaro.




--

rus...@infinite.io

unread,
Aug 11, 2016, 11:32:01 AM8/11/16
to Vagrant
$ vagrant ssh-config
Host ff1
  HostName 172.16.136.153
  User niska
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/niska/.ssh/id_rsa
  IdentitiesOnly yes
  LogLevel FATAL

Host ff2
  HostName 172.16.136.144
  User niska
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/niska/.ssh/id_rsa
  IdentitiesOnly yes
  LogLevel FATAL

As to the Vagrantfile, i'm unable to make the change suggested:
Vagrantfile:37: syntax error, unexpected '[', expecting '|'
    config.vm.define opts[:name] do |opts[:name]|

Here's what I tried:
$ cat Vagrantfile
# encoding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :

boxes = [
  {
    :name => "ff1",
    :ssh_port => "2221",
    :https_port => "4441",
    :seg1a => "vmnet10",
    :seg1b => "vmnet11",
    :seg2a => "vmnet12",
    :seg2b => "vmnet13",
  },
  {
    :name => "ff2",
    :ssh_port => "2222",
    :https_port => "4442",
    :seg1a => "vmnet20",
    :seg1b => "vmnet21",
    :seg2a => "vmnet22",
    :seg2b => "vmnet23",
  },
  {
    :name => "ff3",
    :ssh_port => "2223",
    :https_port => "4443",
    :seg1a => "vmnet30",
    :seg1b => "vmnet31",
    :seg2a => "vmnet32",
    :seg2b => "vmnet33",
  }
]

Vagrant.configure(2) do |config|
  boxes.each do |opts|
    config.vm.define opts[:name] do |opts[:name]|

      opts[:name].vm.box_version = "2.0.0.408"
      opts[:name].vm.box = "ff"
      opts[:name].vm.box_url = "file://../scripts/ff"

      opts[:name].vm.hostname = opts[:name]

      opts[:name].vm.network :forwarded_port, guest: 22, host: opts[:ssh_port], id: 'ssh'
      opts[:name].vm.network :forwarded_port, guest: 443, host: opts[:https_port]

      opts[:name].vm.provider "vmware_workstation" do |v|
         v.vmx["numvcpus"] = "4"
         v.vmx["memsize"] = "8192"
         v.gui = false

         v.vmx["ethernet0.present"] = "TRUE"
         v.vmx["ethernet0.connectionType"] = "nat"
         v.vmx["ethernet0.virtualDev"] = "e1000"
         v.vmx["ethernet0.linkStatePropagation.enable"] = "TRUE"

         v.vmx["ethernet1.present"] = "TRUE"
         v.vmx["ethernet1.connectionType"] = "custom"
         v.vmx["ethernet1.virtualDev"] = "e1000"
         v.vmx["ethernet1.vnet"] = opts[:seg1a]

         v.vmx["ethernet2.present"] = "TRUE"
         v.vmx["ethernet2.connectionType"] = "custom"
         v.vmx["ethernet2.virtualDev"] = "e1000"
         v.vmx["ethernet2.vnet"] = opts[:seg1b]

         v.vmx["ethernet3.present"] = "TRUE"
         v.vmx["ethernet3.connectionType"] = "custom"
         v.vmx["ethernet3.virtualDev"] = "e1000"
         v.vmx["ethernet3.vnet"] = opts[:seg2a]

         v.vmx["ethernet4.present"] = "TRUE"
         v.vmx["ethernet4.connectionType"] = "custom"
         v.vmx["ethernet4.virtualDev"] = "e1000"
         v.vmx["ethernet4.vnet"] = opts[:seg2b]

         v.vmx["ethernet5.present"] = "TRUE"
         v.vmx["ethernet5.connectionType"] = "custom"
         v.vmx["ethernet5.virtualDev"] = "e1000"
         v.vmx["ethernet5.vnet"] = "vmnet9"
       end
    end
  end

   config.vm.box_check_update = false

   # disable the default
   #config.vm.synced_folder '.', '/vagrant', disabled: true

end

Alvaro Miranda Aguilera

unread,
Aug 12, 2016, 3:44:26 AM8/12/16
to vagra...@googlegroups.com
Hello,

It may be related that you are parsing that yamls not sure if the evaluated variable is expanded properly in |here|

Can you test with the HelloWord multi machine? it think it will work, and will confirm that your yalm magic may be causing some issues.. but not sure how to make it work properly.. so worth the check

vagrant up 

it should take vmware provider automatically

As you are in the vmware plugin world, you can also email sup...@hashicorp.com

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"

  config.vm.define "web" do |web|
    web.vm.box = "apache"
  end

  config.vm.define "db" do |db|
    db.vm.box = "mysql"
  end
end

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/953ee875-c5cc-4d64-9c29-45148690b5ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages