I have two vagrant boxes (wordpress VVV and laravel homestead) running at the moment at the same time. I always ssh to the machine with putty if I run vagrant homestead first I can only ssh this one machine at once. If I halt this machine by running vagrant halt and when trying to ssh to I get "connection refused". How I can halt one machine and when straight away ssh to the other running vagrant box instead?


You can ssh into multiple running vagrant machines at the same time if you know the port mappings between the guests and host. There's really no point in halting one machine in order to just ssh into another one.

Edit the Vagrantfiles of each vagrant environment, and add the following line:

config.vm.network "forwarded_port", guest: 22, host: <PORT_NUMBER>, id: "ssh"

Where <PORT_NUMBER> must be replaced by a port available on your host machine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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