Laravel Homestead:无法从VM内部ping任何.local站点 [英] Laravel Homestead: Can't ping from inside of the VM any .local sites

查看:117
本文介绍了Laravel Homestead:无法从VM内部ping任何.local站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道问题出在哪里.我的另一个同事从主机Mac以及从VM内部ping foo.local都没有问题.

No idea where's the issue. My other workmate has no issues pinging foo.local from the host Mac as well as from inside of the VM.

我的Homestead.yaml很简单:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/code

sites:
    - map: vppaportal.local
      to: /home/vagrant/code/vppa-portal/public
    - map: iosportal.local
      to: /home/vagrant/code/ios-portal/public
    - map: ascent.local
      to: /home/vagrant/code/ascent/public
    - map: peem.local
      to: /home/vagrant/code/peem-v2/public

databases:
    - homestead

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# zray:
#  If you've already freely registered Z-Ray, you can place the token here.
#     - email: foo@bar.com
#       token: foo
#  Don't forget to ensure that you have 'zray: "true"' for your site.

因此,当我的Homestead运行时,在我的Mac上可以运行ping iosportal.local并且可以运行,但是当我ssh进入计算机并执行ping iosportal.local时,我得到:

So when my Homestead is running then on my mac I can ping iosportal.local and it works, but when I ssh into the machine and do ping iosportal.local I get:

vagrant@homestead:~/code$ ping iosportal.local
ping: iosportal.local: Temporary failure in name resolution

推荐答案

我通过在宅基地内部打开/etc/hosts 并添加了

I solved this by opening /etc/hosts inside the Homestead and adding:

127.0.1.1 iosportal.local

重点是我的任何一个同事都不需要这样做,因此我认为这是一个临时解决方法.如果有人会提出更好的解决方案,我很乐意支持并更改已接受的答案.

The point is that none of my workmates had to do this hence I consider this as a temporary workaround. If someone will come up with better solution I'm happy to upvote and change accepted answer.

这篇关于Laravel Homestead:无法从VM内部ping任何.local站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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