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.

I have 2 NICs and 2 physical links from 2 different ISPs. I want to set up a Windows XP virtual PC with VirtualBox to use the 2nd link. But I don't want the host (Windows 7) to use it, I actually want it to ignore it in all cases.

I have set up bridged on the network settings for the VM, and to the proper NIC. As far as I know, there is no way to dedicate a NIC to a VM using VirtualBox, so thats why I want to tell Windows 7 to ignore the 2nd link.

share|improve this question
    
I'm not certain but if you run the VM in bridged mode you can probably just not set a gateway on the 2nd NIC in the host OS... ie, change it from dynamic IP to static and put it on some other subnet to your first network, don't define a gateway (this was the only route created for the connection should be related to the subnet only) Then because it's bridged adapter to the VM, that OS should be able to get its real IP and gateway etc ... +1 because curious for someone to give a better way to do this now too :) –  Ben Stephens Aug 21 '12 at 6:42
    
Just don't configure or enable IP on the interface. –  David Schwartz Aug 21 '12 at 6:52
add comment

2 Answers

The selection of a route (and therefore interface) is based on the metric of the route. When confronted with two routes (i.e. same subnet, same router, different interfaces), Windows (actually all IP implementations) should select the route with the lowest metric. The metric represents the "cost" of a route: these days it's really just a preference value.

You should be able to set the metric of the interface the host should use to a lower one of of that of the VM and Windows should select that one over the VM-only interface.

Caveat - it's possible to set the interface metric on Windows, but I've never tried it with two identical routes. Should work though.

Here's a KB article for XP/Windows 2000 which explains a bit about setting metrics; this article has a detailed step-by-step procedure to set it.

Good luck!

share|improve this answer
    
You could also set a permanent default route on Windows, to say "route all traffic out of this interface". That should be ignored by VirtualBox. this might help. –  Faelkle Aug 23 '12 at 9:31
add comment

If I understood well your question, you want to have the real machine on a network card and the virtual machine on another.

I don't know any solution to prevent the real machine from using both cards without affecting the virtual machine, but here's a trick:

For the real machine, go to network setting and unselect Obtain IP Address automatically for both IPv4 and IPv6. Choose a random IP that doesn't belong to the network you want to connect to, that way the real machine will not know to whom she's supposed to talk to. Now in virtual box, chose a bridged connection to this network.

Next time you boot you get your real machine connected to both networks but only understand one, and the virtual machine only sees the one that the real machine ignores.

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.