2

I am running a Debian server as a VM in VirtualBox, which itself is running on a (real) Windows 7 computer.

For test purposes, I need to be able to access a web application running on the Debian VM via a web browser which is running on the actual host Windows computer (but the website should not be accessible from anywhere else on the internet). The VM itself does also need to have a functioning connection to the internet so that it can download software updates, etc.

Using a browser running on the VM OS, it is possible to access the website using the (dummy) hostname (FQDN) of the VM (with the default single virtual network interface set up and automatically configured for NAT), and I can access the internet in general, but trying to access the website via the (small) VM window is rather inconvenient and not very desirable.

From the VirtualBox networking documentation it looks as though I perhaps may need to set up an (additional?) bridged virtual network interface in order to make the webserver on the VM available to the real host computer, but I am afraid I am not finding the instructions clear.

I have tried to create a new virtual interface via the VirtualBox Network Settings, and have set it as "Bridged Adapter", but this only seems to have set up an IPv6 address automagically somehow (and has not created an IPv4 address setup?). If it is relevant, our site does not yet support IPv6, and so the website on the VM probably needs to be accessible to the real host OS via IPv4?

Although I can access the site home page on the host OS via the IPv6 IP address, as soon as I try to add an URI path in the address bar, this reverts to the (fake) hostname of the virtual computer, and so I can't access the rest of the site.

Am I proceeding in the right direction, or is using NAT with port forwarding (also listed on the network page), perhaps also an option?

I'm afraid I'm not finding the VirtualBox documentation much help at all, and any clarification of what I need to do would be much appreciated.

2 Answers 2

1

I am not sure if this is actually the best solution for this problem, but after some further experimentation, the following seemed to work:

  1. Create a second network interface in VirtualBox, and set it to operate in "host-only" mode.

  2. Edit the hosts file on the host OS to add a hardcoded IP address for the hostname of the virtual machine.

In this case, the host OS is Windows, and the hosts file is: c:\windows\system32\drivers\etc\hosts

  1. This then allowed a web browser running on the host OS to connect to the website/webserver running in the VM on the guest OS.

My only concern is that there may be a risk that VirtualBox may decide at some point in the future not to assign the same (private network) IP address to the second network interface, depending on how it determines to do these things.

[Information about editing the Windows hosts file courtesy of: Editing the hosts file

1
  • 1
    Host-only is indeed the way to go. You could use a static IP address on the guest-side interface.
    – Daniel B
    Jul 7, 2017 at 11:38
0

First off just turn off IP6 unless your using it anyway, sounds like you are putting way to much over thinking in this. Create a bridge, check the firewall and open only the ports you need. You can you to pretty much any good site and google whats my external IP address. With this info you should be be able to check any port and since you have the WAN address.

If your still still having problems shoot me a email [email protected] and i can remote in and help you out.

1
  • Thanks, sorry if my wording was unclear: the bridge virtual network interface seemed to set itself up with IPv6 automatically, but not with IPv4 at all. Indeed, our site does not yet support IPv6, and so we need for the virtual computer to be visible over IPv4. It only needs to be visible to the host OS (Windows) on the actual computer that the VM is running on, and not to the internet at large.
    – dave559
    Jul 3, 2017 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .