【发布时间】:2020-07-16 13:46:46
【问题描述】:
我似乎无法通过 SSH 连接到我的虚拟盒子。
我有一个运行 Win7 的虚拟机。主机PC也在Win7中。 虚拟盒子是通过 Vagrant 使用以下 Vagrantfile 创建的。
Vagrant.configure("2") do |config|
config.vm.box = "http://aka.ms/vagrant-win7-ie11"
end
打开cmd。转到 VagrantFile 的根文件夹。 执行以下命令:
vagrant up
cmd 显示:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot...
虽然虚拟机已完成启动,但出现超时。 (通过 VirtualBox Manager 检查)
执行以下命令:
vagrant ssh
cmd 显示:
ssh_exchange_identification: read: Connection reset by peer
在调试 vagrant ssh 时,我可能发现了一些有用的日志:
INFO subprocess: Starting process: ["C:\\Program Files\\Git\\usr\\bin/ssh.EXE"]
INFO ssh: Invoking SSH: ss ["vagrant@127.0.0.1", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "C:/Users/hostpcname/.vagrant.d/insecure_private_key"]
您能否提出一些摆脱困境的方法? 我尝试了非 Windows 映像 - hashcorp/precise64,效果很好。
【问题讨论】:
-
同样的错误。你找到解决办法了吗?
标签: windows ssh vagrant virtualbox