【问题标题】:Why is Vagrant trying to SSH to Windows guest?为什么 Vagrant 试图通过 SSH 连接到 Windows 客户机?
【发布时间】:2014-06-27 18:29:42
【问题描述】:

我的主机运行的是 Windows 7 Pro(64 位)。在这种情况下,来宾操作系统是 Windows Server 2008 R2。 “vagrant up”命令遇到了我不断遇到的问题:

****default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: password
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...****

直到它最终超时并说:

等待机器启动时超时。这意味着 Vagrant 无法与内部的来宾机器通信 配置的(“config.vm.boot_timeout”值)时间段。 如果你看上面,你应该能够看到错误 Vagrant 在尝试连接到机器时出现过。这些错误 通常可以很好地提示可能出现的问题。 如果您使用的是自定义框,请确保网络正确 工作,您可以连接到机器。这是一个常见的 在这些框中未正确设置网络的问题。 验证身份验证配置是否也设置正确, 也是。 如果该框似乎可以正常启动,您可能需要增加 超时(“config.vm.boot_timeout”)值。

虚拟机实际上运行良好,可访问且可用。

  • 为什么还要尝试通过 SSH 连接到 Windows 机器?

我的 Vagrantfile 内容是:


Vagrant.configure("2") do |config|

  # Max time to wait for the guest to shutdown
  config.windows.halt_timeout = 60

  # Admin user name and password
  config.winrm.username = "Administrator"
  config.winrm.password = "Password"

  # Configure base box parameters
  config.vm.box = "BaseBox"
  config.vm.box_url = "./Base.box"
  config.vm.guest = :windows
  config.vm.provider "virtualbox" do |v|
    v.gui = true
  end

  # Port forward WinRM and RDP (changed values to NOT conflict with host)
  config.vm.network :forwarded_port, guest: 3389, host: 3391
  config.vm.network :forwarded_port, guest: 5985, host: 5987, id: "winrm", auto_correct: true

end

【问题讨论】:

  • 你安装了 vagrant-windows 吗? gem install vagrant-windows
  • 我应该在原始帖子中添加此内容,但我忘记了。我使用站点上的 Windows 二进制文件安装了 Vagrant 1.6.1。我还在我的 Windows 7 机器上运行了 4.3.10r93012 版本的 Virtual Box。

标签: virtualbox vagrant vagrantfile


【解决方案1】:

你需要使用

   config.vm.communicator = "winrm"

在你的流浪文件中。 Take a look at this feature preview

【讨论】:

  • 感谢您的 dfedde。它肯定有帮助,我没有得到重复的“默认值:警告:远程连接断开”。重试...”的消息。但我仍然在接近尾声时超时。和上一次一样,我在使用虚拟机时没有任何问题,而且它看起来功能齐全。
  • 它还在尝试通过 ssh 连接吗?
  • 关于使用 winrm 的超时,我也遇到了这个问题。我发现我的域策略禁用了“允许未加密的流量”设置(计算机配置\管理模板\Windows 组件\Windows 远程管理 (WinRM)\WinRM 客户端)。似乎即将通过加密通道支持 winrm:github.com/mitchellh/vagrant/pull/3960
【解决方案2】:

我在 Windows 7 中遇到过这个问题。最后我们发现这个问题是由于我们使用的与 Vagrant 版本的 Linux 操作系统不兼容。因此,我们采用了最新版本(即 v1.6.3)的 Vagrant 并将我们的操作系统更新为指向 agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-i386-v20131103.box"

Vagrant 版本 4.3.8 不适用于以下操作系统。 agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box".

我希望这有助于解决问题。

【讨论】:

    猜你喜欢
    • 2013-11-21
    • 2017-03-16
    • 1970-01-01
    • 2021-08-08
    • 1970-01-01
    • 2013-07-01
    • 1970-01-01
    • 2011-09-13
    • 1970-01-01
    相关资源
    最近更新 更多