Search code examples
ruby-on-railsmacosvagrantping

Vagrant ping or curl from guest to host machine


I wonder how I can run the command, using the terminal, from my vagrant machine:

$ ping localhost:3000

or

$ curl http://localhost:3000

In host machine (OSX) I have a rails server running in localhost:3000, so I expect something to show in the rails log.


Solution

  • When I run in the VM:

    $ ip route show

    In the output there is a line like:

    default via 10.0.2.2 dev enp0s3 proto static metric 1024

    That is the IP to ping from the guest:

    curl http://10.0.2.2:3000