VMware Cloud Community
rahasya
Contributor
Contributor

When multiple nics are attached to a VM, device config id of the nics are not distinct.

When multiple nics are attached to a VM, device config id of the nics are not distinct.

We thought of distinguishing multiple nics of a VM by its deviceConfigId, but since it is not distinct we cannot use deviceConfigId as the identifier or primary key.

Ask is

1. Is this by design or bug at the vcenter end.

2. If it is by design, can you folks please suggest how do I distinguish between multiple nics, specifically which set of properties of GuestNicInfor should I use to generate the unique guid.

Below is the view for one of my machine.

Machine had 13 nic out of which 11 were of id 4001, 1 of id 4000 and 1 of id 0

[

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"10.100.250.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.252.98"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"10.83.10.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"10.45.16.20"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.252.59"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.106.12"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.237.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"10.100.236.198",

"192.168.233.198",

"192.168.236.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.210.60",

"192.168.241.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.253.198",

"192.168.254.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 2",

"NicId": "4001",

"NetworkName": "alla-vlan-trunk-0-4094-2",

"IpAddressList": [

"192.168.238.198",

"192.168.239.198",

"192.168.250.198"

],

"MacAddress": "00:50:56:b7:00:60",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 1",

"NicId": "4000",

"NetworkName": "griffel-lan-55-2",

"IpAddressList": [

"2a06:c0:1:0:74ee:46:a6e0:f635",

"192.168.23.75"

],

"MacAddress": "00:50:56:b7:00:58",

"IpAddressType": "Static"

  },

  {

"Label": "Network adapter 3",

"NicId": "0",

"NetworkName": "",

"IpAddressList": [],

"MacAddress": "00:50:56:ac:74:7b",

"IpAddressType": "Static"

  }

]

Tags (1)
0 Kudos
3 Replies
LucD
Leadership
Leadership

I don't know how you got your data, but I definitely see different DeviceIds for each vNIC.

I used this code

Get-VM -Name VM1 | Get-NetworkAdapter |

Select Name,@{N='Id';E={$_.ExtensionData.Key}}

And this returned

Name                Id

----                --

Network adapter 1 4000

Network adapter 2 4001

Network adapter 3 4002

Network adapter 4 4003

Network adapter 5 4004

Network adapter 6 4005


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
rahasya
Contributor
Contributor

I use

$vms = Get-VM

foreach($vm in $vms)

{

        $nics= $vm.Guest.Nics

        foreach($nic in $nics)

        {

            Write-Output "DeviceId:" $nic.Device.Id

            Write-Output "Network Name:" $nic.Device.NetworkName

            Write-Output "Mac Address:" $nic.Device.MacAddress

        }

}

Note: Its not always I end up in duplicate nicids condition.

Ask is: Does VMWare specifies in its documentation somewhere that this deviceids will be unique always or it can be duplicate.

0 Kudos
LucD
Leadership
Leadership

Yes, in the VirtualDevice documentation it states clearly that the Key is
"A unique key that distinguishes this device from other devices in the same virtual machine. "


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos