I have an app that I have to change the /etc/hosts
file to be able to hit. Here is my new file.
#127.0.0.1 localhost
127.0.0.1 local.connectwithme
This works easily on my local machine. I just go to local.connectwithme:3000
in my browser and I am able to view my app.
I am now trying to view it with VirtualBox
running Windows 7
. Typically I would just go to the ip address 10.0.2.2
in the browser of the virtual machine and access the localhost
of my host machine from the VirtualBox
, but now that I have changed the /etc/hosts
file on my host machine I don't know what I need to hit to see my app on the virtual machine. Could someone please explain this to me. Thanks.
To access the host OS when using a NATed Virtual Box connection, you need to determine the IP address of the host OS (on the other side of the NAT) and then add this IP address to the hosts file on your guest OS:
From within the guest OS, determine your default gateway. This will be the IP address of the host OS. The easiest way to do this is to open a command prompt and run ipconfig /all
. Under the Ethernet adapter
, find the Default Gateway. This is almost certinaly 10.0.2.2 if you haven't changed anything.
Now, find your hosts file and add the host IP address. On Windows 7, this file is located in %systemroot%\system32\drivers\etc\
.
%systemroot%\system32\drivers\etc\hosts
in Notepad (you'll need to change it to show all files).10.0.2.2 local.connectwithme
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With