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,
},
]
Mike says
A shame it doesn’t show the switchport itself.
Duncan Epping says
It will actually show that depending on your switch and set up. In my case it doesn’t but in many cases it will.
Mike says
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”,
Sean D says
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.
Bert de Bruijn says
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.
Duncan Epping says
That is “hint info”, this is CDP which is something different.
John says
I think Sean D is correct. I’m not sure it is an issue of hint info vs CDP info. I don’t believe that the CDP information received from a Cisco switch is always complete when you run
vim-cmd hostsvc/net/query_networkhint
We know that on Cisco routers and switches, CDP information is exchanged by speciallly formatted CDP advertisement packets. ESXi’s implementation of CDP is either getting information from other packets that happen to have network information, but aren’t actually CDP advertisements, or ESXi is not reading all the information available in the CDP advertisments, or it isn’t keeping the CDP advertisement information long enough between intervals when advertisements are sent.
Other people are saying the same thing as well:
http://communities.vmware.com/message/2262569