Laravel Homestead:无法从VM内部ping任何.local站点

时间:2019-07-23 06:14:59

标签: laravel homestead

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

我的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时,我得到:

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

1 个答案:

答案 0 :(得分:0)

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

来解决此问题

127.0.1.1 iosportal.local

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