为什么Vagrant尝试SSH到Windows客户端?

aks*_*ray 14 virtualbox vagrant vagrantfile

我的主机运行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...****
Run Code Online (Sandbox Code Playgroud)

直到它最终超时并说:

等待机器启动时超时.这意味着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
Run Code Online (Sandbox Code Playgroud)

dfe*_*dde 17

你需要使用

   config.vm.communicator = "winrm"
Run Code Online (Sandbox Code Playgroud)

在你的流浪文件中.看看这个功能预览