Search code examples
laravelhomestead

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


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.

My Homestead.yaml is simple:

---
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.

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

Solution

  • 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.