How to access localhost on Virtualbox host machine

76,608

First you should change the Network adapater to Bridged (It seems you are choosing NAT)

enter image description here

Then you can give an ip to your guest machine other than 10.0.2.15 (or you can leave it if you want)

then open a browser from your host machine and type: ip-address-of-your-guest-machine/...

Share:
76,608

Related videos on Youtube

aliasbody
Author by

aliasbody

Updated on September 18, 2022

Comments

  • aliasbody
    aliasbody over 1 year

    I created a virtual machine on Virtualbox with Ubuntu 12.04 only to install a LAMP solution and use it with my host machine, but I can't access the localhost using the ip (10.0.2.15) in the browser .

    Is there any way to solve this problem ?

    • penreturns
      penreturns over 11 years
      Run ifconfig | grep inet on VM and browse using that ip from your Host.
    • aliasbody
      aliasbody over 11 years
      It gives me this : "inet end.: 10.0.2.15 Bcast:10.0.2.255 Masc:255.255.255.0, endereço inet6: fe80::a00:27ff:fe0b:7fee/64 Escopo:Link" but the 10.0.2.15 don't work, and ping to this ip only results on a 100% lost packages.
    • penreturns
      penreturns over 11 years
      From your VM, can you access 10.0.2.15? Does UFW enable? Did you allow port?
  • aliasbody
    aliasbody over 11 years
    Thank you for your help. But, when I select Bridged Adapter I loose the connection, and even after restarting (when Virtualbox doesn't give me any error), I can't connect at all (on the guest machine) to the network. How can I solved this ?
  • Admin
    Admin over 11 years
    are you sure that you give an ip of same range of your network?!
  • Admin
    Admin over 11 years
    be sure to give ip similar to your host with same dns and same gateway
  • aliasbody
    aliasbody over 11 years
    I can't enable my virtual machine with the Bridged Adapter because it crashes and keep asking be about the vboxdrv (that is started), when I switch to NAT it loads without any problem. I will try to change from NAT to Bridged and then make they use the same ip to see if it works.
  • aliasbody
    aliasbody over 11 years
    Sorry my fault ! I messed up with the modules :S... But now I activated normally and everything is working :D (I just need to remember to not mess manually with the modules like I do on Arch Linux). Thank you very much for you help :D
  • Admin
    Admin over 11 years
    You are welcome but please mark as answer to help others later