On Tue, Oct 2, 2018 at 9:15 AM Richard W.M. Jones <rjones@redhat.com> wrote:
I wrote some code which can get this kind of information from the
Windows Registry:

    <interfaces>
      <interface name="Ethernet" type="unknown">
        <parameters>
          <parameter name="bootproto">dhcp</parameter>
          <parameter name="gateway">10.0.2.2</parameter>
          <parameter name="ipaddr">10.0.2.15</parameter>
          <parameter name="win:AddressType">0</parameter>
          <parameter name="win:DhcpConnForceBroadcastFlag">0</parameter>
          <parameter name="win:DhcpGatewayHardware">
</parameter>
          <parameter name="win:DhcpGatewayHardwareCount">1</parameter>
          <parameter name="win:DhcpNameServer">10.0.2.3</parameter>
          <parameter name="win:DhcpServer">10.0.2.2</parameter>
          <parameter name="win:DhcpSubnetMask">255.255.255.0</parameter>
          <parameter name="win:DhcpSubnetMaskOpt">255.255.255.0</parameter>
          <parameter name="win:Domain"></parameter>
          <parameter name="win:EnableDeadGWDetect">1</parameter>
          <parameter name="win:IsServerNapAware">0</parameter>
          <parameter name="win:Lease">86400</parameter>
          <parameter name="win:LeaseObtainedTime">1536802270</parameter>
          <parameter name="win:LeaseTerminatesTime">1536888670</parameter>
          <parameter name="win:NameServer"></parameter>
          <parameter name="win:RegisterAdapterName">0</parameter>
          <parameter name="win:RegistrationEnabled">1</parameter>
          <parameter name="win:T1">1536845470</parameter>
          <parameter name="win:T2">1536877870</parameter>
          <parameter name="win:UseZeroBroadcast">0</parameter>
        </parameters>
      </interface>
      <interface name="Local Area Connection* 9" type="unknown">
        <parameters>
          <parameter name="bootproto">dhcp</parameter>
          <parameter name="win:Domain"></parameter>
          <parameter name="win:EnableDeadGWDetect">1</parameter>
          <parameter name="win:NameServer"></parameter>
          <parameter name="win:RegisterAdapterName">0</parameter>
          <parameter name="win:RegistrationEnabled">1</parameter>
          <parameter name="win:UseZeroBroadcast">0</parameter>
        </parameters>
      </interface>
    </interfaces>

Unfortunately - no MAC address!

That screws up the plan greatly, since without the MAC address there
is no way to associate network adapters with hardware.

Well, that's not quite true.  There is some PCI address information
available.  For example for the above guest we have:

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{307052F7-EE0A-4FD2-8CE6-212EFDD711B0}\Connection]
"DefaultNameResourceId"=dword:0000076c
"DefaultNameTargetsPort"=dword:00000000
"Name"=str(1):"Ethernet"
"PnPInstanceId"=str(1):"PCI\VEN_10EC&DEV_8139&SUBSYS_11001AF4&REV_20\3&13C0B0C5&0&18"

It's not clear if we could go from this to a hypervisor network
interface however.

Also the MAC address of the guest is visible in some very obscure
places in the registry in binary blobs.

I don't think I've yet got a full picture of how network adapters are
stored in Windows.

Rich.

It's a bit of a mess based on some of my investigation today.  From what I have read s it even may differ from 2008/2012 to 2016. 

We are maintaining the MAC address today as part of migration, for the new virtio NIC.  Instead of trying to find the MAC address is there a way to move the IP config over based on vmxnet or IE1000 enumeration?  Thinking of other options outside of MAC linkage. 
 

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org


--
Brett Thurber - RHCA, RHCVA
Engineering Manager and Sr. Principal Software Engineer, Solutions Engineering
Products & Technologies Group, Red Hat
Mobile: +1 (512) 547-9282