Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running VirtualBox 4.2 on Windows Server 2003 and I am trying to ping the IP address of the guest virtual machine from the Windows host (ICMP is not being blocked).

The guest is 192.168.0.1 and the host is on a different subnet, 192.168.1.100. The virtual machine's networking settings looked like this:

vm network settings

and the host network config looked like this:

enter image description here

I added a secondary IP address of 192.168.0.2 to the host NIC shown in the screenshot above and was unable to ping 192.168.0.1 from the host. I found it odd that the "VirtualBox Bridged Networking Driver" checkbox was unchecked (this was the default following VirtualBox install), so I checked it, and had the same problem.

As a test I then changed the guest's network settings use the host-only adapter, as shown below:

enter image description here

and on the host I edited the "VirtualBox Host-Only Network" adapter's settings to have an IP address on the 192.168.0.x segment as follows:

enter image description here

but was still unable to ping. Note: If I change the primary address of the host's network adapter to be on the 192.168.0.x segment than I am able to ping the 192.168.0.1 guest. But I still need the host to be on it's original network.

Thoughts?

share|improve this question
    
You're doing it wrong. Your guest OS should have an IP address on the same network as the host. –  Skyhawk Nov 17 '13 at 2:11
add comment

3 Answers 3

So you are bridging the VM NIC with a 192.168.0.x ip to a LAN which runs 192.168.1.* ?

That ain't going to work of course.

When you bridge the VM NIC works "in parallel" to the hosts NIC on the same LAN.
That means that BOTH machines (host and guest) are in the SAME subnet and should use an ip-address in that range.

You can make it work with different ip-ranges, but you will have to re-configure the router in that case. It must have an ip-address in each subnet and route between the 2 L3 subnets on the same L2 LAN.
And both machines need to use that router (the routers ip-address for their own subnet) as their default gateway.

Please note that super-imposing 2 subnets on the same L2 LAN may cause some undesired side-effects. A lot of equipment won't like it. It may also cause some issues with your DHCP server (e.g. if it is a Microsoft DHCP server the superscope needs to be setup correctly).

share|improve this answer
    
Part 1 of 2 - I updated my question above and struck my last sentence. I can't ping in any config at all. About your stmt: "When you bridge the VM NIC works 'in parallel' to the hosts NIC on the same LAN. That means that BOTH machines (host and guest) are in the SAME subnet and should use an ip-address in that range.", my understanding is that the bridge is by definition a layer 2 concept. So bridging the two NICs wouldn't put them in the same IP subnet, but rather the same "physical" network... –  Howiecamp Mar 21 '13 at 0:49
    
Part 2 of 2 - ...Just like how in the physical world you can have different IP ranges running on the same segment. So shouldn't having two nics (one physical and one virtual) which are bridged, and with the physical one having multiple IP addresses-one in each subnet-shouldn't this allow me to ping without having to go to an external router and back? –  Howiecamp Mar 21 '13 at 0:51
    
@Howiecamp That should in theory work. Make sure you keep the default gateway on the host pointing to the real default gateway (192.168.1.*) or your host may have some really bad network issues on normal traffic. If the Windows firewall is enabled make sure you allow the 192.168.0.* ip-addresses too ! –  Tonny Mar 21 '13 at 19:52
add comment

Try adding a route on the Windows host in order to use the correct source IP (i. e. the IP from the same subnet the VM is in):

route add 192.168.0.0 mask 255.255.255.0 192.168.0.2
share|improve this answer
add comment

If you're going to use bridged networking, you need to treat the guest exactly the same as a physical computer on your network, i.e. it needs to have an IP address on the same subnet.

share|improve this answer
add comment

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.