1

I have 3 vagrant boxes

vagrant box list

hashicorp/precise32 (virtualbox, 1.0.0)
hashicorp/precise64 (vmware_fusion, 1.1.0)
laravel/homestead   (virtualbox, 0.4.2)

when I do vagrant up, and vagrant ssh, I kept logged into hashicorp/precise32 machine.

How do I ssh into this box hashicorp/precise64?

2 Answers 2

1

vagrant ssh {hostname}


Example

if you declare 3 Vms in your vagrant file.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "lb01" do |lb01|
    lb01.vm.box = "ubuntu/trusty64"
    lb01.vm.hostname = "lb01"
    lb01.vm.network :private_network, ip: "10.11.12.50"
  end

  config.vm.define "web01" do |web01|
    web01.vm.box = "ubuntu/trusty64"
    web01.vm.hostname = "web01"
    web01.vm.network :private_network, ip: "10.11.12.51"
  end

  config.vm.define "web02" do |web02|
    web02.vm.box = "ubuntu/trusty64"
    web02.vm.hostname = "web02"
    web02.vm.network :private_network, ip: "10.11.12.52"
  end
end

Then, after running vagrant up, I can just vagrant ssh lb01 I should be log-in into lb01 VM.

1

in your project directory, you have defined a Vagrantfile, in this Vagrantfile, you have pointed the box which needs to be used for the VM you spin, something like

Vagrant.configure("2") do
  config.box = "hashicorp/precise32"
end

If you want to create a new VM from the hashicorp/precise64 box you need to have

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

to make sure you do not delete anything, just create a new folder and a new Vagrantfile. To spin up your new instance do

vagrant up --provider vmware_fusion

Not the answer you're looking for? Browse other questions tagged or ask your own question.