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

Laravel Homestead: Can't ping from inside of the VM any .local sites

不知道问题出在哪里。我的另一个同事从主机 Mac 和虚拟机内部 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 进入 machine and do ping iosportal.local 我得到:

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

我通过在宅基地中打开/etc/hosts并添加:

解决了这个问题

127.0.1.1 iosportal.local

重点是我的 none 同事必须这样做,因此我认为这是一种临时解决方法。如果有人想出更好的解决方案,我很乐意投票并更改已接受的答案。