Puphpet/Vagrant:无法使用IP地址访问LAMP VM [英] Puphpet/Vagrant: Unable to access LAMP VM with IP address

查看:122
本文介绍了Puphpet/Vagrant:无法使用IP地址访问LAMP VM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Puphpet.com在VirtualBox 5.1.24上部署了本地Ubuntu 16.04 LAMP开发计算机.我用虚拟机IP地址(192.168.56.101)更新了/etc/hosts.

I used Puphpet.com to deploy a local Ubuntu 16.04 LAMP development machine with VirtualBox 5.1.24. I updated /etc/hosts with the VM IP address (192.168.56.101).

$ cat /etc/hosts

127.0.0.1   localhost
127.0.1.1   flippy
192.168.56.101  dev.mysite.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我可以通过SSH进入虚拟机,但是无法通过IP地址(192.168.56.101)或域名进行访问.

I can SSH into the VM, but I cannot access it via IP address (192.168.56.101) nor domain name.

Ping失败:

$ ping 192.168.56.101

PING 192.168.56.101 (192.168.56.101) 56(84) bytes of data.
^C
--- 192.168.56.101 ping statistics ---
164 packets transmitted, 0 received, 100% packet loss, time 166895ms

卷曲失败:

$ curl -v 192.168.56.101

* Rebuilt URL to: 192.168.56.101/
*   Trying 192.168.56.101...
* connect to 192.168.56.101 port 80 failed: Connection timed out
* Failed to connect to 192.168.56.101 port 80: Connection timed out
* Closing connection 0
curl: (7) Failed to connect to 192.168.56.101 port 80: Connection timed out

此外,主机上的netstat -rn不会显示VM IP地址的溃败:

Additionally netstat -rn on host machine does not show a rout for the VM IP address:

$ netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlp1s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlp1s0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp1s0

我还能检查什么?

推荐答案

我已经在此处提供了答案相信是相关的,但是如果其他人想知道该线程以寻找解决方案,我也会在此处发布.

I've provided an answer here that I believe is related however I will post it here as well incase anyone else wonders into this thread looking for a solution.

这听起来很像VirtualBox 5.1.24中的错误(已在5.1中修复) .26.

This sounds a lot like a bug in VirtualBox 5.1.24 which is fixed in 5.1.26.

该问题似乎是由于VirtualBox无法为仅主机的网络创建路由而引起的.要检查是否存在这种情况,请在主机上运行vagrant up后,从终端运行netstat -rn.这将在内核的IP路由表中显示可用的溃败.将有几行输出,但是在其中,您应该看到专用网络IP看起来像这样:

The problem seems to be caused by VirtualBox failing to create a rout for host-only networks. To check if this is the case, after running vagrant up on your host machine run netstat -rn from your terminal. This will show you available routs in your Kernel's IP routing table. There will be several lines of output but among it you should see your private networks IP looking something like this:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.56.101  0.0.0.0         255.255.255.0   U         0 0          0 vboxnet3

如果您没有看到该IP的路由设置,那么您可能已被此bug咬伤了.升级到Virtualbox 5.1.26为我(在Linux上)解决了该问题.但是 puphpet.com 在家里说了这一点页面:

If you don't see a rout set for that IP then you have likely been bitten by this bug. Upgrading to Virtualbox 5.1.26 fixed the problem for me (on Linux.) However puphpet.com says this on the home page:

官方推荐的Virtualbox版本是5.0.26!

The official recommended Virtualbox version is 5.0.26!

所以您可能需要回滚到该版本

So you may want to roll back to that version

这篇关于Puphpet/Vagrant:无法使用IP地址访问LAMP VM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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