How to tell Windows 7 which default network card (NIC) to use?

1

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.

CS01

Posted 2012-08-21T06:36:42.817

Reputation: 325

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 – 2012-08-21T06:42:21.450

Just don't configure or enable IP on the interface. – David Schwartz – 2012-08-21T06:52:13.337

Answers

0

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!

Faelkle

Posted 2012-08-21T06:36:42.817

Reputation: 215

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 – 2012-08-23T09:31:05.060

0

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.

MSIS

Posted 2012-08-21T06:36:42.817

Reputation: 211