GN.
GN.

Reputation: 9829

Vagrant: Accessing host machine localhost from guest machine (Mac)

I'm trying to access localhost (a Rails app) from Internet Exporer running on a VirtualBox (via Vagrant).

I've set up the following.
config.vm.network "forwarded_port", guest: 3100, host: 3000

Typing in the following into Internet Exporer running on the VM does not work:

<my host machines IP>:3100
0.0.0.0:3100
localhost:3100

Access to the guest machine from the host is does not work.

Lots of tutorials online covering setting up Vagrant to test IE, but not much on accessing hosts localhost from the guest machine browser.

Upvotes: 2

Views: 1127

Answers (1)

Stefan Lindberg
Stefan Lindberg

Reputation: 603

This is an old question but for anyone else looking for an answer I found this solution

vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]

By proxy and hostresolver to the vagrant box I can access same hosts as host-machine.

I also found this to be a good start config for Vagrant IE boxes https://gist.github.com/andreptb/57e388df5e881937e62a

Upvotes: 1

Related Questions