Forwarding ports from one machine to another

61 views
Skip to first unread message

Tomek Rabczak

unread,
Nov 15, 2016, 3:48:43 PM11/15/16
to Vagrant
Hi, 

I'm trying to configure a multi-machine environment in which one master VM has a redis process running on it. I'd like to setup port forwarding between one master machine and potentially multiple slave machines. Normally I'd accomplish this by running `ssh -R 127.0.0.1:6379:127.0.0.1:6379 user@master` on each slave machine. Is there a way to set this up through the vagrantfile. Is that the best/correct way to accomplish something like this?

Thanks,
Tomek

Alvaro Miranda Aguilera

unread,
Nov 16, 2016, 3:53:29 PM11/16/16
to vagra...@googlegroups.com
on vagrant documentation you need multi machine and port forward


ie


Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: "echo Hello"

  config.vm.define "web" do |web|
    web.vm.box = "apache"
  web.vm.network "forwarded_port", guest: 80, host: 8080
end config.vm.define "db" do |db| db.vm.box = "mysql" end end

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/3bbe6a00-449e-4074-aee4-4fabfec9a9ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Tomek Rabczak

unread,
Nov 18, 2016, 3:34:26 PM11/18/16
to vagra...@googlegroups.com
Yes I've gone over the documentation however the example you posted sets up port forwarding for guest VM to host. I'm looking to establish forwarding from one guest VM to another guest VM.

You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/YeOZfCIk-WE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewbKAG0vWp6b7xbTHzsmnjz2YM0Na6frZBejs1wfME3mQ%40mail.gmail.com.

Alvaro Miranda Aguilera

unread,
Nov 18, 2016, 9:07:55 PM11/18/16
to vagra...@googlegroups.com
hello

the best is use a private_network

say 192.168.56.22 to one vm
192.168.56.23 to the other

and then you got a private network



For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages