On a machine with multiple NICs, running either Windows or Linux, is it possible to dedicate a NIC to a VM such that the host won't even try to use it for itself? I suspect it isn't even possible but if it is, which OS and version and just how would I set it up?

The reason for this, apart from academic curiosity, is that I'm trying to set up a network lab for testing purposes. I currently have only a single spare machine, otherwise this wouldn't be an issue. One of the VMs will be the firewall for this lab network, so will need a dedicated NIC for the WAN interface. Neither ESXi nor Xen server will run on the machine, so I have to use a host OS.


Solution 1:

I actually do this on Windows now - in a manner of speaking.

On the host OS, it has to see the NIC to actually pass it on to the guests, but I went into the adapter and disabled and detached most every service (IPv4/v6, netbios, etc.). I suppose it can still technically be talked to through things like ARP, but for my purposes - this was good enough and certainly the host isn't going to use it for anything useful.

In VirtualBox, I then selected that adapter and configured it in Bridged mode. Like magic, the guest appears as a full fledged machine on the LAN, and the host (at least on that adapter) appears invisible.

Solution 2:

With a linux host there are plenty of ways to hack this up.

One of the neatest would be to use OpenVSwitch to manage the networking, then you just create a private vlan.

Another is to simply bridge the nics and simply don't have the host assign an IP address (If you need IPv6 you also need to mess about a little to disable ipv6 address creation, but if, like most, you don't care about ipv6 then you don't need to worry).