Run Vagrant machine on remote server but use as local

2

1

I'm not quite sure if I can really do it in that way:

Scenario at the moment: My laptop is running a vagrant machine "laravel/homestead" to serve as a webserver. To run it and connect to it - I type vagrant up && vagrant ssh.
So while developing, all the processing, compilation, writing, copying, moving etc. is on the laptop's responsibilites. And it exceeds it's hardware resources, laptop is start working slow.

Scenario I would like to establish: I want to run a vagrant machine on my personal pc (Remote PC) from my laptop via the same vagrant command vagrant up.
So, basically all the processing and heavy load will be on Remote PC, and laptop will be used for manipulating the remote pc.

I tried to setup on remote PC a vagrant file with this configuration:

config.vm.network "public_network", ip: "192.168.1.18"

192.168.1.18 is set to accept incoming traffic on port 2222 by port forwarding configured in router settings.

But I can't run it via vagrant connect 192.168.1.18:2222

What I'm doing wrong ?

aspirinemaga

Posted 2018-03-21T15:06:03.320

Reputation: 229

Hey did you ever find a solution to this? – Dan – 2018-08-04T09:13:34.890

1yeah, I did, but forgot to give an answer here. I will check out and post an answer – aspirinemaga – 2018-08-05T13:23:56.020

@aspirinemaga If you could add the answer that would be really helpful – Camilo Casadiego – 2018-09-03T16:47:02.270

1@CamiloCasadiego I hardly recall how I have done it. Try edit your Vagrant file with following line: ‘config.vm.network :forwarded_port, guest: 22, host: 2222, host_ip: "localhost", id: "ssh", auto_correct: true‘ and connect to your remote machine with it's actual IP address: ssh vagrant@192.168.11.15 -p 2222 – aspirinemaga – 2018-09-04T12:31:55.963

1@CamiloCasadiego - try this one, this worked for me ssh vagrant@192.168.11.15 -p 2222 – aspirinemaga – 2018-09-09T06:24:41.087

No answers