При создании двух виртуальных машин с помощью Vagrant v.1.8.1 вторая виртуальная машина также хочет использовать порт 2222 (даже если произошла коллизия, разрешенная для порта 2200):
Вот мой Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.define "master" do |master|
master.vm.box = "centos"
end
config.vm.define "slave1" do | slave1 | slave1.vm.box = "centos" end end
И вывод:
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'slave1' up with 'virtualbox' provider...
==> master: Importing base box 'centos65'...
==> master: Matching MAC address for NAT networking...
==> master: Setting the name of the VM: tapd-cluster_master_1461971062767_92860
==> master: Clearing any previously set network interfaces...
==> master: Preparing network interfaces based on configuration...
master: Adapter 1: nat
==> master: Forwarding ports...
master: 22 (guest) => 2222 (host) (adapter 1)
==> master: Booting VM...
==> master: Waiting for machine to boot. This may take a few minutes...
master: SSH address: 127.0.0.1:2222
master: SSH username: vagrant
master: SSH auth method: private key
master:
master: Vagrant insecure key detected. Vagrant will automatically replace
master: this with a newly generated keypair for better security.
master:
master: Inserting generated public key within guest...
master: Removing insecure key from the guest if it's present...
master: Key inserted! Disconnecting and reconnecting using new SSH key...
==> master: Machine booted and ready!
==> master: Checking for guest additions in VM...
==> master: Mounting shared folders...
master: /vagrant => C:/cygwin64/home/randys/vagrant/tapd-cluster
==> slave1: Importing base box 'centos65'...
==> slave1: Matching MAC address for NAT networking...
==> slave1: Setting the name of the VM: tapd-cluster_slave1_1461971109891_81433
==> slave1: Fixed port collision for 22 => 2222. Now on port 2200.
==> slave1: Clearing any previously set network interfaces...
==> slave1: Preparing network interfaces based on configuration...
slave1: Adapter 1: nat
==> slave1: Forwarding ports...
slave1: 22 (guest) => 2200 (host) (adapter 1)
==> slave1: Booting VM...
==> slave1: Waiting for machine to boot. This may take a few minutes...
slave1: SSH address: 127.0.0.1:2222
slave1: SSH username: vagrant
slave1: SSH auth method: private key
slave1: Warning: Authentication failure. Retrying...
slave1: Warning: Authentication failure. Retrying...
Обратите внимание, как Vagrant пытается подключиться к slave1 через порт 2222.