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.

Well i have setup a VM in Virtual Box in a PC (label as PC2) and i have hosted a webservice in the VM (IIS).

PC2 - Windows Server 2003 VM - Windows 7 x86

Now i want to access the webservice from another PC (label as PC1) within a network which PC1 has connected. Following diagram will be helpful to get the clear idea.

enter image description here

So the LAN is 192.168.5.0. But virtual network ports ip is 192.168.56.1 by defualt. In the VM its ip from DHCP by defualt. (ipconfig gives you ip address like 10.0.0.2.15, subnet mask 255.255.255.0 and gateway as 10.0.2.2).

at this point i can ping PC1 (192.168.5.31) from VM (10.0.2.15) but i cannot ping 10.0.2.15 from PC 1. even if i make VM and PC2 virtual ports ips to some static range, from VM i cant ping any IP.

How to solve this situation? Thanks in advance

share|improve this question

migrated from stackoverflow.com Nov 26 '12 at 9:49

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

If you just used the default Network settings in your VM, it will be NAT with DHCP. That means you get a LAN IP from your VirtualBox DHCP Server and you can't really access the machine from the outside.

Check out the VirtualBox Manual on Networking: https://www.virtualbox.org/manual/ch06.html#networkingmodes

I guess bridged neworking should be best. You should configure a static IP address.

EDIT: Concerning the edit removing "host-only networking": It's true that you can't see the VM from outside. But you get virtual interfaces (vboxnetX) on your host machine. So if you route it through, it should work. The setup is more complicated, but the VM is less exposed.

share|improve this answer
    
thanks i sorted it out by making it as Adapter and restarted the VM –  Keizer Nov 27 '12 at 14:27

You should either expose IP address of VM to external network and NOT make it DHCP, either set up packet routing on PC2 so it will work as proxy (which i've no idea how will you do it on Windows, on Linux it is way easier).

As an option you can setup web-server on PC2 and make it proxying to VM, but again in this case u better off with static IP for VM and not DHCP.

Third option would be combine all of machines into VPN where PC2 will be a router/server. But that is too complex on Windows to set up.

share|improve this answer
    
well i make it static and set it as a bridge adapter same happens where i can get a network range ip on VM bt cannot ping from outside –  Keizer Nov 26 '12 at 11:12

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.