0

Ok here's the situation.

I am running an Ubuntu Operating System as a VirtualBox instance in Windows 7.

The main system, Windows 7, and the Ubuntu OS have Apache installed.

Now my main system (Windows 7) has a public IP address //whatismyip

If I keep both Apache servers [In Windows and Ubuntu] running, is it possible to identify each of them with a distinct physical IP, and access each one separately?

Basically, is it possible to make the VirtualBox OS to get a new physical IP so that it is distinct from the host?

My goal is to access each of them from external networks, not in the LAN/ same WAN.

Sorry if it's too obvious. I am a beginner and my networking knowledge is bad!

3 Answers 3

0

You can't assign an additional public IP to a VM (at least not in a classic configuration and you'd have to pay for additional IPs), but there's a workaround.

HTTP servers run on port 80 by default. You can forward any of your host's ports to VM's 80. This way it will be accessible under the same public IP, but on another port.

To do this for port 81 (just an example), open VM's settings, then click Network tab and expand Advanced options. Click the Port forwarding button and add a new rule. Set the host port to 81 and guest port to 80.

For example if your IP address is 192.0.2.1, then 192.0.2.1 will point to the server running on host machine and 192.0.2.1:81 will be the guest's server.

1
  • That's it. Let me try it out! Thanks @gronostaj! Feb 9, 2013 at 21:56
0

Yes, what you need to do is configure the VirtualBox guest to use a Bridged adapter, not NAT or Host-only or anything else. This will cause the physical adapter to pick up packets for both your host and guest on the actual network, and allow for separate IPs.

Once you do this, when you start your guest it will have an adapter that acts like it is connected to the same network as the host.

enter image description here

2
  • Hi Andrew.. This will work when systems are on the same LAN/WLAN.. It will not work on a system from an external network.. Feb 9, 2013 at 21:58
  • Having a NAT is independent of bridging the adapter or not. You can DMZ or port forward the bridged IP address just as you would a normal IP address.
    – Andrew Mao
    Feb 9, 2013 at 23:13
0

While I don't know about virtual box specifically. If you go under your NIC's settings, you can go in to the IPV4 options and under advanced, you can configure the IP Addresses for your computer. Normally, when DHCP is being used, your computer will take whatever is assigned, but if you use static IPs internally, then you can specify multiple static IPs. From there, you'd have to look at the binding options in VirtualBox to see if it will let you bind to one of the IPs exclusively. Another option can be to use separate NICs for each system if you have multiple physical NICs.

1
  • Thanks @AJ.. I will try out this approach with multiple systems.. Feb 9, 2013 at 21:54

You must log in to answer this question.

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