Nut*_*tim 32 networking virtual-machine vagrant
我有一个盒子配置文件使用Vagrant.现在我想将Vagrant用于另一个盒子(b2),但是它说bioiq的实例正在消耗转发的端口2222(它是).
现在,如果我用下面的配置b2,Vagrant仍然会尝试使用2222.
Vagrant.configure("2") do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.network :forwarded_port, guest: 22, host: 2323
# Neither of these fix my problem
# config.vm.network :private_network, type: :dhcp
# config.vm.network :private_network, ip: "10.0.0.200"
end
Run Code Online (Sandbox Code Playgroud)
我尝试了其他SO问题的各种方法来设置:forwarded_port(见这里和这里).我也试过这个谷歌集团的帖子,但没有用.我一直收到这条消息.
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 2222 is already in use
on the host machine.
To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 22, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.
Run Code Online (Sandbox Code Playgroud)
我不知道为什么Vagrant一直无视我的指示.发布的配置不起作用.有没有人克服过这个?
m1k*_*eil 78
在ssh端口的情况下,Vagrant自己解决端口冲突:
==> ubuntu64: Fixed port collision for 22 => 2222. Now on port 2200.
Run Code Online (Sandbox Code Playgroud)
但是,您仍然可以通过以下方式创建不可避免的碰撞:
vagrant suspend)vagrant up您将收到现在收到的错误消息.
解决方案是使用vagrant reload,让vagrant discard虚拟机状态(这意味着它将以困难的方式关闭它 - 所以如果你有任何未保存的工作那么要小心)并再次启动环境,解决路上的任何ssh端口冲突通过它自己.
bot*_*mer 15
我刚刚在当前版本的Mac OSX(10.9.4)和VirtualBox(4.3.14)上遇到问题,其中默认的ssh端口2222既未使用也未被绑定.它导致sanity检查ssh连接无限期地超时.
这不是完全相同的问题,但明确的前向解决了它:
config.vm.network :forwarded_port, guest: 22, host: 2201, id: "ssh", auto_correct: true
Run Code Online (Sandbox Code Playgroud)
这个建议来自对Vagrant GitHub 问题1740的评论.
目前尚不清楚是否正在检测转发到22的端口或是否使用了ID,但它对我有用.