Homestead + Virtualbox双IP无法访问Laravel项目

时间:2018-10-28 10:15:33

标签: laravel vagrant virtualbox homestead

我刚刚安装了Homestead,并在192.168.0.12处配置了虚拟以太网适配器,并在10.0.0.70处配置了桥接适配器。我的办公室IP地址范围是10.0.0.0。第二个IP是这样,以便开发站点对LAN上的其他计算机可见。

我的第一个IP在Homestead.yaml中:

---
ip: "192.168.0.12"
memory: 4096
cpus: 2
provider: virtualbox

我的第二个是在Vagrantfile中

# NW CONFIG
config.vm.network "public_network", ip: "10.0.0.70", bridge: "eth2: This Killer Ethernet Controller connects you to the network."

虚拟机启动,我可以在ubuntu guest虚拟机中看到适配器。我可以从Win 10主机ping通两个适配器。

C:\Users\PAPA>ping dev.myproject.com.au

Pinging dev.myproject.com.au [192.168.0.12] with 32 bytes of data:
Reply from 192.168.0.12: bytes=32 time<1ms TTL=64
Reply from 192.168.0.12: bytes=32 time<1ms TTL=64
Reply from 192.168.0.12: bytes=32 time<1ms TTL=64
Reply from 192.168.0.12: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.0.12:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Users\PAPA>ping dev.myproject.com.au

Pinging dev.myproject.com.au [10.0.0.70] with 32 bytes of data:
Reply from 10.0.0.70: bytes=32 time<1ms TTL=128
Reply from 10.0.0.70: bytes=32 time<1ms TTL=128
Reply from 10.0.0.70: bytes=32 time<1ms TTL=128
Reply from 10.0.0.70: bytes=32 time<1ms TTL=128

Ping statistics for 10.0.0.70:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

如果我将主机文件设置为将我的开发域指向192.168.0.2,则Laravel将提供该页面。

如果我将其指向10.0.0.70,则会得到:

This site can’t be reached dev.myproject.com.au refused to connect.
Search Google for dev myproject au
ERR_CONNECTION_REFUSED

我错过了什么,以便可以通过10.地址访问该网站?谢谢。

0 个答案:

没有答案