I was doing some troubleshooting this week and needed the CDP network info. I did not have access to a vSphere client, only HP iLO access. I remoted into the ESXi box and enable ESXi Shell. I knew that I could dig up the info using esxcfg-info but the amount of details provided are overwhelming and I would rather get only the info back I need without too much hassle. I figured there was another way:
vim-cmd hostsvc/net/query_networkhint
The one thing that I find it very useful for is to check the configured VLAN(s) on the port. Below is the result of the above command:
(vim.host.PhysicalNic.NetworkHint) [
(vim.host.PhysicalNic.NetworkHint) {
dynamicType = ,
device = "vmnic0",
subnet = (vim.host.PhysicalNic.NetworkHint.IpNetwork) [
(vim.host.PhysicalNic.NetworkHint.IpNetwork) {
dynamicType = ,
vlanId = 3001,
ipSubnet = "10.91.34.1-10.91.35.254",
},
(vim.host.PhysicalNic.NetworkHint.IpNetwork) {
dynamicType = ,
vlanId = 2912,
ipSubnet = "10.91.32.1-10.91.32.63",
}
],
connectedSwitchPort = (vim.host.PhysicalNic.CdpInfo) null,
lldpInfo = (vim.host.PhysicalNic.LldpInfo) null,
},
]






A shame it doesn’t show the switchport itself.
It will actually show that depending on your switch and set up. In my case it doesn’t but in many cases it will.
Oh, it does indeed
~ # vim-cmd hostsvc/net/query_networkhint |grep portId
portId = “GigabitEthernet1/0/32″,
portId = “GigabitEthernet2/0/32″,
portId = “GigabitEthernet1/0/8″,
portId = “GigabitEthernet2/0/8″,
portId = “GigabitEthernet1/0/7″,
portId = “GigabitEthernet2/0/7″,
I have found the vlan list to not always be complete. In our environment we sometimes have a VLAN presented to a cluster of ESX servers for only one or two VMs. In these cases, those VLANs will often not show up the network hint info on all of the ESX servers, even though I know the VLANs are configured on the switch.
indeed, the VMkernel only shows a VLAN and subnet if it saw incoming traffic for it. In your case, maybe there wasn’t any relevant incoming traffic for that VLAN.
That is “hint info”, this is CDP which is something different.