I'm sure this question will have been asked somewhere before. In fact I'm sure I've read about it before too, but I can find any resources to help me along my way.
What I'm trying to do is deploy a set of Hyper-V servers without having to do anything other than start the process. I can think of ways to configure everything through PowerShell and/or unattend.xml
, except for the network adapters. The commands are available, but there's one significant problem:
How do I get Windows to consistently detect the correct adapter to assign each network to?
These are clustered Hyper-V hosts with multiple IP addresses and VLANs, and teamed adapters but my understanding is that Windows detects adapters in a random order. To script it, I need consistency. I can't assume that Local Area Connection 12
is always port 3 on card 2, for example. The same physical port on each cluster node will be connected to the same VLAN or aggregate.
- Do I have to go around and collect the MAC address of every port on every adapter and have some kind of lookup table in my scripts?
- Is there an attribute in WMI/registry that I can reference when configuring my adapters and teams?
Answering my own question, because I stumbled across the answer the other day.
What I was looking for was Consistent Device Naming. Apparently this problem is not specific to Windows devices.
https://en.m.wikipedia.org/wiki/Consistent_Network_Device_Naming
This problem downs not manifest itself in the same way under Windows, but as I described in my question. Ultimately, Windows uses the name provided by the BIOS rather than the default "Local Area Connection #X". This means the interface names persist between OS builds.
I'm not sure how prevalent the hardware support of it is, but the more recent Dell and HP generations have this feature in the BIOS It is also fully supported for physical device deployment in System Center Virtual Machine Manager. Scripts can also be written to configure interfaces, because it's safe to assume the interface name is always the same.
For anyone working with Virtual Machine Manager, see http://www.hyper-v.nu/archives/mvaneijk/2013/08/system-center-vmm-2012-r2-bare-metal-deployment-with-converged-fabric-and-network-virtualization-part-1-intro/. This series of posts is of really good quality.