Which switch port is an ESXi vmnic connected to?

When I am given an ESXi host to build and configure, it is not always clear which vmnic is connected to which port on the physical switch nor which vmnic should be used for what purpose. When I am in this situation, I turn to CDP information. It does not always give a definite answer but it helps me ask the right question to the Network Admin.

There are different ways to view CDP information in ESXi. My favorite way is to use this command

# vim-cmd hostsvc/net/query_networkhint --pnic-name=vmnic[xx]

Sample Output

    ~ # vim-cmd hostsvc/net/query_networkhint --pnic-name=vmnic1
    (vim.host.PhysicalNic.NetworkHint) [
       (vim.host.PhysicalNic.NetworkHint) {
          dynamicType = ,
          device = "vmnic1",
          subnet = (vim.host.PhysicalNic.NetworkHint.IpNetwork) [
             (vim.host.PhysicalNic.NetworkHint.IpNetwork) {
                dynamicType = ,
                vlanId = 0,
                ipSubnet = "",
          connectedSwitchPort = (vim.host.PhysicalNic.CdpInfo) {
             dynamicType = ,
             cdpVersion = 2,
             timeout = 0,
             ttl = 155,
             samples = 12908,
             devId = "switch1.net.rtfmp.com",
             address = "",
             portId = "GigabitEthernet1/0/10",
             deviceCapability = (vim.host.PhysicalNic.CdpDeviceCapability) {
                dynamicType = ,
                router = false,
                transparentBridge = false,
                sourceRouteBridge = false,
                networkSwitch = true,
                host = false,
                igmpEnabled = true,
                repeater = false,
             softwareVersion = "unknown",
             hardwarePlatform = "cisco WS-C3750G-24TS-1U",
             ipPrefix = "",
             ipPrefixLen = 0,
             vlan = 10,
             fullDuplex = true,
             mtu = 0,
             systemName = "",
             systemOID = "",
             mgmtAddr = "",
             location = "",
          lldpInfo = (vim.host.PhysicalNic.LldpInfo) null,

The output tells vmnic1 is connected to this switch and port

    devId = "switch1.net.rtfmp.com",
    portId = "GigabitEthernet1/0/10",

I can now give this information to the Network Admin and ask for what VLAN, for what IP subnet this port is configured.

If the vmnic is configured for a single VLAN, most likely it will be connected to a port in access mode. When a vmnic is connected to a port in access mode, this is how I see it

        vlanId = 0,
        ipSubnet = "",

Notice the VLAN ID is 0 but this isn’t real VLAN ID.

If the vmnic is meant for multiple VLANs, it will be connected to a trunk port and this is how it looks like.

        vlanId = 10,
        ipSubnet = "",

This also means I will need add VLAN ID to my portgroup in ESXi.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s