Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accessing localhost from vm

I need to access my local environment from inside a vm. There's several posts about how to do this, but I need to be able to access my localhost by typing "localhost" in the address bar, because it uses facebook authentification, and if the domain is not recognized, it doesn't work.

How can I set so that "localhost" in my vm points to "localhost" outside the vm ?

like image 450
ksol Avatar asked Jan 25 '12 10:01

ksol


People also ask

How do I access localhost?

Usually, you can access the localhost of any computer through the loopback address 127.0. 0.1. By default, this IP address references a server running on the current device. In other words, when your computer requests the IP address 127.0.

Can a VM see the host?

Virtual machines use a virtual network device on the host machine to be able to route traffic into and out of the virtual machine. The host machine will be able to see the network activity of the virtual machine because the host is communicating on behalf of it.


1 Answers

you can change the IP address of the localhost to whatever the IP of the host has in your hosts file.

If the vm machine is windows the file is located at c:\windows\system32\drivers\etc\hosts

just open up the hosts file in notepad and edit

127.0.0.1 localhost

to

192.168.0.1 localhost

not sure if it works, but you can atleast try

like image 64
trembon Avatar answered Sep 23 '22 00:09

trembon