from config/default.rb
# Share SSH locally by default
config.vm.network :forwarded_port,
guest: 22,
host: 2222,
host_ip: "127.0.0.1",
id: "ssh",
auto_correct: true
it seems impossible to disable this port_forwarding which in turn really requires the first interface to be a NAT interface.
This is a very serious problem for any of us that use 2 boxes at the same time.
I cannot presently get 2 boxes to boot simultaneously as the 2nd boot complains that port 2222 is already in use and I cannot find any workaround.
Any update on this issue?
What version of Vagrant are you using? I seem to have no problems, running
multiple boxes at the same time.
On Wed, Aug 21, 2013 at 10:47 AM, Alan Pinstein [email protected]:
This is a very serious problem for any of us that use 2 boxes at the same
time.I cannot presently get 2 boxes to boot simultaneously as the 2nd boot
complains that port 2222 is already in use and I cannot find any workaround.Any update on this issue?
—
Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1922#issuecomment-23022444
.
1.2.7, just upgraded today to see if it's fixed.
All of my boxes use private networking, that might be the thing that "reveals" this bug.
On Aug 21, 2013, at 11:18 AM, canausa [email protected] wrote:
What version of Vagrant are you using? I seem to have no problems, running
multiple boxes at the same time.On Wed, Aug 21, 2013 at 10:47 AM, Alan Pinstein [email protected]:
This is a very serious problem for any of us that use 2 boxes at the same
time.I cannot presently get 2 boxes to boot simultaneously as the 2nd boot
complains that port 2222 is already in use and I cannot find any workaround.Any update on this issue?
—
Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1922#issuecomment-23022444
.—
Reply to this email directly or view it on GitHub.
You can now set disabled: true on forwarded ports to disable them. You can override (always have been able to do this) by matching the same host port and protocol.
So, this would be the expected syntax to "disable" the built-in port forwarding?
# once we're on our custom port, disable the built-in host -> guest:22 forwarding so that we can spin up multiple vagrants without incident.
config.vm.network :forwarded_port, guest: 22, disabled: true
Incidentally, I wouldn't have cared about the default 2222->22 forwarding so long as the auto-collision detection worked... but it didn't seem to... is that a known bug or should I file something there, too?
@apinstein It does seem odd the collision detection didn't work actually. Is this Windows or Linux? And its keyed by host port, so set the "host:"
It was on Mac OS Host / Linux guest(s).
On Aug 29, 2013, at 4:24 PM, Mitchell Hashimoto [email protected] wrote:
@apinstein It does seem odd the collision detection didn't work actually. Is this Windows or Linux? And its keyed by host port, so set the "host:"
—
Reply to this email directly or view it on GitHub.
If you can make a minimal reproducible case then yes please do report a bug.
Ok, will do if I get time…
On Aug 29, 2013, at 4:28 PM, Mitchell Hashimoto [email protected] wrote:
If you can make a minimal reproducible case then yes please do report a bug.
—
Reply to this email directly or view it on GitHub.
This doesn't work for me in 1.3.1 on OSX, because the config validation complains:
* Forwarded port '2222' (host port) is declared multiple times
with the protocol 'tcp'.
I believe this is easily fixed by skipping the network validation in plugins/kernel_v2/config/vm.rb when options[:disabled] is set (This is already done for shared folders).
_Follow-up_
Skipping the validation gets past the error mentioned above, but the port forward is still not disabled.
To reproduce:
vagrant init an empty project, and edit the Vagrantfile and ensure the following line is present:config.vm.network :forwarded_port, guest: 80, host: 8080~/.vagrant.d/Vagrantfile, include the lineconfig.vm.network :forwarded_port, guest: 80, host: 8080, disabled: truevagrant upI run into the same problem as @bdcribbs ... on 1.3.1, upgraded just to try this feature.
config.vm.network :forwarded_port, guest: 22, host: 2222, disabled: true
Results in * Forwarded port '2222' (host port) is declared multiple times
with the protocol 'tcp'.
The only way I was able to change the default forward port was by using
config.vm.network :forwarded_port, id: "ssh", guest: 22, host: 2223
I'm using vagrant 1.3.5 on OSX.
I didn't specify any network configuration in Vagrantfile for ssh forwarded port collision on vagrant 1.3.1 on OSX. command vagrant reload does work to resolve ssh port collision automatically:
$ vagrant reload
[default] Attempting graceful shutdown of VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Booting VM...
I do believe it works fine when no networking is provided, however if you use private networking for your guests you cannot have 2+ up a the same time due to port collisions.
On Jan 29, 2014, at 11:53 AM, shawnzhu [email protected] wrote:
I didn't specify any network configuration in Vagrantfile for ssh forwarded port collision on vagrant 1.3.1 on OSX. command vagrant reload does work to resolve ssh port collision automatically:
$ vagrant reload
[default] Attempting graceful shutdown of VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Booting VM...
—
Reply to this email directly or view it on GitHub.
opened new issue: #3232
This works for me:
config.vm.network :forwarded_port, guest: 22, host: 2200, id: "ssh",
disabled: "true"
config.vm.network :forwarded_port, guest: 22, host: 2230
==> default: Forwarding ports...
default: 80 => 9082 (adapter 1)
default: 22 => 2230 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2230
default: SSH username: vagrant
default: SSH auth method: private key
On Sun, Mar 16, 2014 at 6:34 AM, Andrea Barani [email protected]:
opened new issue: #3232 https://github.com/mitchellh/vagrant/issues/3232
Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1922#issuecomment-37732220
.
Also getting the same issue as 8080 port setting was available in packaged vagrant file of the box. Following line helped me.
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
Most helpful comment
This works for me:
config.vm.network :forwarded_port, guest: 22, host: 2200, id: "ssh",
disabled: "true"
config.vm.network :forwarded_port, guest: 22, host: 2230
==> default: Forwarding ports...
default: 80 => 9082 (adapter 1)
default: 22 => 2230 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2230
default: SSH username: vagrant
default: SSH auth method: private key
On Sun, Mar 16, 2014 at 6:34 AM, Andrea Barani [email protected]: