How to change local IP to domain name so a host can access a VM?

15,920

Very easy to do, find your Windows 7 hosts file and put an entry in it. The Windows 7 system will now be able to resolve the name to the IP. I'm running a similar dev environment as to what you're describing. Windows 7 Host running Virtual Box with an Ubuntu server VM.

Windows\System32\Drivers\etc\hosts

Add a line as follows

92.168.56.101           www.example.dev
Share:
15,920
melanie
Author by

melanie

Updated on September 18, 2022

Comments

  • melanie
    melanie over 1 year

    I've managed to set up a Debian server (in a VM) and now I can access it in the Windows 7 host at 192.168.56.101

    Is there any way to "map" that IP to a domain name? It doesn't have to be accessible from the internet, just from the host. Because it's annoying to type the IP in the browser every time I want to access it.

    • Kruug
      Kruug almost 11 years
      Have you tried connecting via \\<vm name>?
    • Ignacio Vazquez-Abrams
      Ignacio Vazquez-Abrams almost 11 years
      Are you running nmbd in the guest?
    • melanie
      melanie almost 11 years
      I'm sorry I don't know what's that :) How do I check if I am?
    • jason
      jason almost 11 years
      What do you mean "access/map?" You mentioned you are using a browser, are you trying to connect to a Web server you have installed?
    • melanie
      melanie almost 11 years
      Yes. It's apache running on debian, which is running in virtualbox, under windows 7
    • Fiasco Labs
      Fiasco Labs almost 11 years
      Put an entry into your hosts file that has the desired host name pointed at the ip.
    • melanie
      melanie almost 11 years
      in /etc/hosts ?