How to configure the host file to direct to the server of a "virtual box" virtual machine?

1

I have a windows 7 virtual machine using virtual box. Inside this machine I have a laravel study project. Inside this machine I access this project through url "lara/" , configured in routes.

I'd like to know how to direct a request from the physical machine url into my virtual machine. What I did was:

  • I got the IP of the virtual machine - 192.168.56.1
  • Set the etc/hosts file of the physical machine to point to the virtual machine when the "lara;" URL is requested. 192.168.56.1 lara/
  • My process is not working. I know I could use Vagrant but I wanted to know how to do this without this tool.

    Is it possible?

        
    asked by anonymous 18.07.2016 / 22:50

    1 answer

    1

    I managed to do it and it was simpler than I thought. I'll share the steps if someone needs to:

  • Configure the virtual machine's network card for "bridge"

  • Open the virtual machine and check the ip . or you can choose the fixed ip setting. Note : this is the terminal of WITHIN THE VIRTUAL MACHINE

  • Open the file hosts of the PHYSICAL MACHINE in C:\Windows\System32\drivers\etc/hosts and pass the ip of the virtual machine. Then refresh the DNS with the following command ipconfig /flushdns

  • NowjusttypeinthebrowseronyourphysicalmachinetheipofthevirtualmachineortheAliaschoseninhostandisready.

  • Note : To make any user in the network group have access, simply follow steps 3 and 4 on each user's machine.

  • Note : On the physical machine I'm using IIS . In the virtual machine I'm using Apache .

  • 22.07.2016 / 17:40