-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vagrant forwarded_ports don't seem to work #22
Comments
There is no forwarded ports functionality in |
Thanks for the answer. I understand that this is the case with vCenter usually. But I would say that forwarding ports is one the most useful things in Vagrant... for example: you can write a single set of unit tests that all can be configured to use e.g. "127.0.0.1:1234" as a backend database address. No matter how many concurrent instances you have running, they will always connect to their own provisioned test backend. It's all about not having to know/care at all about the actual IP address of the provisioned virtual machine. The way it works with VirtualBox and Fusion also. |
I get your point, problem is that VirtualBox and Fusion have a NAT service that fronts VMs and Vagrant controls that NAT service doing port mapping, there is no such thing for ESXi/vCenter (the vCloud and vCloud Air providers actually support the port map feature because it can provision a vShield Edge that does the NAT). The only way you can accomplish that is by creating the port forward INSIDE the VM you're deploying using iptables -t nat -A OUTPUT -p tcp -d 127.0.0.0/8 --dport 80 -j REDIRECT --to-port 1234 you can put that in an inline shell provider and have |
Thanks, sure there are workarounds. I'm currently doing on-the-fly SSH tunnels to overcome this. It's just the beauty of Vagrant handling all that :) Not sure if I understood your suggestion but what I'm after is port forwarding local ports on the Vagrant host to the specified port of the remote guest VM. Not forwarding ports within the guest VM. Actually I was under the impression that Vagrant did the port forwards using SSH also when using remote virtual machines instead of local like VBox and Fusion. |
Ok, I get what you want to do now :) I may need to double check in vagrant core if there are builtins to do SSH port forwarding, will keep this open and see what I can do. thanks for the suggestion! |
Thanks! I looked at Vagrant a bit and it could be that this is not implemented using SSH at all... but I see no reason why it couldn't be. Would be really nice to be able to use same networking layouts for multi-machine environments regardless whether you're using local workstation/fusion stuff or remote vcenter/vcloud. |
Hello,
when trying to set up a Vagrant VM with custom forwarded ports like this: config.vm.network :forwarded_port, guest: 1234, host: 1234 (https://docs.vagrantup.com/v2/networking/forwarded_ports.html) it seems to be doing nothing.
Is this a known feature limitation or...?
Heikki M
The text was updated successfully, but these errors were encountered: