I am trying to use the guard --listen-on option with a --listen-on , as described here , but I cannot get it to work.
If I add config.vm.network :forwarded_port, guest: 4000, host: 4000 to my Vagrantfile and try to start listening with listen -f 127.0.0.1:4000 , I get the error message: Broadcaster.initialize: Address already in use - bind(2) for "127.0.0.1" port 4000 .
If I try to start listening and then start wandering, the tramp complains in a similar way:
Vagrant cannot redirect the specified ports to this virtual machine because they will encounter another application that is already listening on these ports. Forwarded port up to 4000 is already in use on the host machine.
So, I tried other things without sending port forwarding 4000 to Vagrantfile :
If I omit port forwarding 4000 in my Vagrantfile , then I can successfully start listening with listen -f 127.0.0.1:4000 . But then when I run guard -o "10.0.2.2:4000" -w "/home/me/my_project/" on my stray guest, the guard does nothing when the file changes. Adding the -v flag to the listen call indicates that the changes are correctly accepted on the host.
I also tried listen -f 10.11.12.1:4000 on listen -f 10.11.12.1:4000 on the host in combination with guard -o "10.11.12.1:4000" -w "/home/me/my_project/" on the guest system with the same security results that do nothing when changing the file.
Combining listen -f 127.0.0.1:4000 with guard -o "10.11.12.1:4000" -w "/home/me/my_project/" causes the protector to fail to connect.
I also tried port forwarding using ssh:
listen -vf 127.0.0.1:4000 # host ssh -R 4000:localhost:4000 vagrant@10.11.12.13 # connect guard -o "127.0.0.1:4000" -w "/home/me/my_project" # guest
It seems that everything is ok with port forwarding, but again protection never does anything when files are changed.
Both host and guest are ubuntu 14.04.
The network configuration in my Vagrantfile as follows:
config.vm.network 'forwarded_port', guest: 80, host: 3000 config.vm.network 'private_network', ip: '10.11.12.13'
What is the right way to make this work?