Vagrant/virtualbox没有SSH连接和超时(Windows) [英] Vagrant/virtualbox no SSH connection and timeout (Windows)

查看:133
本文介绍了Vagrant/virtualbox没有SSH连接和超时(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试设置此计算机: https://github.com/ByteInternet/hypernode-vagrant

I a trying to setup this machine: https://github.com/ByteInternet/hypernode-vagrant

当我执行vagrant up时,出现以下错误:Timed out while waiting for the machine to boot.

When I do vagrant up i get following error: Timed out while waiting for the machine to boot.

错误的完整上下文:

$ vagrant up
Bringing machine 'hypernode' up with 'virtualbox' provider...
==> hypernode: Will use PHP 7. If you want PHP 5.5 instead change the php version in local.yml.
==> hypernode: Checking if box 'hypernode_php7' is up to date...
==> hypernode: Clearing any previously set forwarded ports...
==> hypernode: Clearing any previously set network interfaces...
==> hypernode: Preparing network interfaces based on configuration...
hypernode: Adapter 1: nat
hypernode: Adapter 2: hostonly
==> hypernode: Forwarding ports...
hypernode: 80 (guest) => 8080 (host) (adapter 1)
hypernode: 3306 (guest) => 3307 (host) (adapter 1)
hypernode: 22 (guest) => 2222 (host) (adapter 1)
==> hypernode: Running 'pre-boot' VM customizations...
==> hypernode: Booting VM...
==> hypernode: Waiting for machine to boot. This may take a few minutes...
hypernode: SSH address: 127.0.0.1:2222
hypernode: SSH username: vagrant
hypernode: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

当我手动启动VM时,可以看到网络无法正常运行.没有连接.当我将VM的设置更改为桥接网络时,网络连接正常.但是流浪汉被配置为NAT.因此,我在设置或无业游民的文件中所做的任何更改似乎都在重置.

When I boot the VM manually, I can see the networking is not working as it should be. There is no connection. When I change the VM's settings to bridged network the networking does work. But the vagrant is configured as NAT. So any changes I make in the settings or in the vagrant file seem to be resetting back.

我在两台不同的PC上尝试了Vagrant 1.9.3、1.9.2和1.9.0.我正在使用Virtualbox 5.1.18.当我过滤带有"NAT"的日志时,看到以下错误(这不是完整的日志,只是一小部分):

I tried Vagrant 1.9.3, 1.9.2 and 1.9.0 on two different PC's. I am using Virtualbox 5.1.18. When I filter down the logs with "NAT" is see following errors (this is not the complete log, only a small portion):

00:00:00.575454 SUP: Loaded VMMR0.r0 (C:\Program     Files\Oracle\VirtualBox\VMMR0.r0) at 0xfffff80c897b0000 - ModuleInit at     fffff80c897d3590 and ModuleTerm at fffff80c897d3a80 using the native ring-0 loader
00:00:01.681747 Driver = "NAT" (cb=4)
00:00:01.962037 SUP: Loaded VBoxDDR0.r0 (C:\Program Files\Oracle\VirtualBox\VBoxDDR0.r0) at 0xfffff80c898d0000 - ModuleInit at         0000000000000000 and ModuleTerm at 0000000000000000 using the native ring-0 loader
00:00:02.196495 NAT: Guest address guess set to 10.0.2.15 by initialization
00:00:02.204465 NAT: DNS#0: 192.168.178.1
00:00:02.271317 NAT: Failed to redirect TCP 127.0.0.1:2222 -> 0.0.0.0:22 (Unknown error)
00:00:02.271732 NAT: Failed to redirect TCP 0.0.0.0:3307 -> 0.0.0.0:3306 (Unknown error)
00:00:02.272033 NAT: Failed to redirect TCP 0.0.0.0:2200 -> 0.0.0.0:80 (Unknown error)
00:00:09.976199 NAT: Link up
00:00:39.428974 NAT: DHCP offered IP address 10.0.2.15
00:00:39.429404 NAT: DHCP offered IP address 10.0.2.15
00:03:02.167191 NAT: DHCP offered IP address 10.0.2.15
00:03:02.167820 NAT: DHCP offered IP address 10.0.2.15
00:07:58.531621 NAT: Zone(nm:mbuf_cluster, used:0)
00:07:58.532221 NAT: Zone(nm:mbuf_packet, used:0)
00:07:58.532232 NAT: Zone(nm:mbuf, used:1)
00:07:58.532419 NAT: Zone(nm:mbuf_jumbo_pagesize, used:0)
00:07:58.532961 NAT: Zone(nm:mbuf_jumbo_9k, used:0)
00:07:58.533255 NAT: Zone(nm:mbuf_jumbo_16k, used:0)
00:07:58.533424 NAT: Zone(nm:mbuf_ext_refcnt, used:0)
00:07:58.536529 Changing the VM state from 'DESTROYING' to 'TERMINATED'

我该如何解决或调试此问题?

How can I solve or debug this?

更新

最近几天,我还尝试了下面列出的不同版本的virtualbox和Vagrant,但没有任何结果:

Last couple of days I also retried with different version of virtualbox and Vagrant listed below without any results:

  • Virtualbox 5.0.18
  • Virtualbox 5.0.20
  • Virtualbox 5.0.36
  • 流浪者1.9.3

我还尝试了另一个具有相同问题的盒子.所以看来这不是盒子,而是主人.

I also tried another box, which has the same problem. So it seems it's not the box but the host.

此外,我尝试在Windows 7计算机上进行安装,结果完全相同.我想我在配置中丢失了一些内容,但是我不知道该怎么办,因为没有明确的指南可以在Windows计算机上使它正常工作.

Furthermore I tried a setup on a Windows 7 machine with exactly the same results. I think I am missing something in the configuration but I don't know what since there is not a definitive guide to get this working on a Windows machine.

更新2:我尝试使用的计算机可能不支持这种设置吗?我尝试在BIOS中寻找虚拟化选项.

UPDATE 2: Could it be possible the machines I try this on do not support this kind of a setup? I tried looking for virtualizations options in the BIOS.

更新3:当我从主机向来宾执行ssh -v 127.0.0.1 -p 1222时,出现以下错误. SSH服务已启动并在客户机上运行.我用sshd service status检查了.

UPDATE 3: When I do ssh -v 127.0.0.1 -p 1222 from my host to the guest I get following error. SSH service is up and running on the guest. I checked with sshd service status.

$ ssh -v 127.0.0.1 -p 1222
OpenSSH_7.3p1, OpenSSL 1.0.2k  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1222.
debug1: connect to address 127.0.0.1 port 1222: Connection refused
ssh: connect to host 127.0.0.1 port 1222: Connection refused

更新4:我无法从访客计算机ping任何Internet IP或域.

UPDATE 4: I cannot ping any internet IP's or domains from the guest machine.

更新5:已解决!现在切换到Linux已经有一段时间了.有史以来最好的决定:D

UPDATE 5: SOLVED! Switched to Linux for quite a while now. Best decision ever :D

推荐答案

首先,将第一个接口更改为NAT是正常行为.这是使无所事事的要求.

First of al, changing the first interface to NAT is normal behavior. It's a requirement in order to make vagrant work.

您可以检查两件事: 1)偏好设置>网络> NAT网络. (设置应如下所示):

You can check two things: 1) preferences > network > nat-network. (settings should be like this):

网络设置

2)确保您已连接虚拟电缆

2) make sure you're virtual cable is connected

电缆已连接

3)也许您可以尝试另一个无用的盒子.

3) maybe you can try another vagrant box.

这篇关于Vagrant/virtualbox没有SSH连接和超时(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆