Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

3 Answers 3

up vote 0 down vote accepted

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.

share|improve this answer
    
That's it. Let me try it out! Thanks @gronostaj! –  atomic_coder Feb 9 '13 at 21:56

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

share|improve this answer
    
Hi Andrew.. This will work when systems are on the same LAN/WLAN.. It will not work on a system from an external network.. –  atomic_coder Feb 9 '13 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 '13 at 23:13

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.

share|improve this answer
    
Thanks @AJ.. I will try out this approach with multiple systems.. –  atomic_coder Feb 9 '13 at 21:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.