问题
I ran my virtual machine by the command "vagrant up" and it's ok. "vagrant ssh" work good and the output of ifconfig is:
vagrant@precise32:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:12:96:98
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe12:9698/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:583 errors:0 dropped:0 overruns:0 frame:0
TX packets:420 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65606 (65.6 KB) TX bytes:56229 (56.2 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
My Homestead.yaml is:
ip: 192.168.10.10
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:/Users/franc/.ssh/id_rsa.pub
keys:
- C:/Users/franc/.ssh/id_rsa
folders:
-
map: C:/Users/franc/Websites/Prova
to: /home/vagrant/Code/prova
sites:
-
map: Prova.app
to: /home/vagrant/Code/prova/public
databases:
- homestead
name: prova
hostname: prova
but when I try to browse my webapplication it doesn't work. I tried with http://prova.app, 192.168.10.10:8000, 127.0.0.1:8000, http://localhost:8000 but it still doesn't work.
That my Hosts File:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.10.10 prova.app
UPDATE: I reinstalled VirtualBox (latest version), generate a ssh-key with PuTTygen saving the public as id_rsa.pub and the private as id_rsa (without extension) and put in .ssh folder. Cloned Homestead repository and add homestead box. Configured Homestad.yaml and at the end start "vagrant up" after adding a project now everything works good.
回答1:
Are you able to Ping your vagrant box IP or does it fail with 0 packets received?
This sounds like a lot like a bug in VirtualBox 5.1.24. That ticket is labeled as Linux host but it is possible it is effecting Windows as well.
The problem seems to be caused by VirtualBox failing to create a rout for host-only networks. Rolling VirtualBox back to 5.1.22 fixed the problem for me (on Linux.) If you roll back as well and it fixes the problem I suggest you chime in on the bug tracker to let them know. Good luck!
来源:https://stackoverflow.com/questions/45299570/homestead-doesnt-work