Last week while attending VMware's R&D Innovation Offsite (RADIO), I ran into Christian Dickmann, who as many of you know works on the VSAN team. During our discussion, he mentioned a nifty little utility called lldpnetmap that he had used recently. This utility is found within the ESXi Shell and provides a quick and easy way to display the mapping between an ESXi hosts physical network interface to the physical switch they are connected to using LLDP (Link Layer Discovery Protocol). This is similar to what Cisco's proprietary discovery protocol (CDP) provides, but only details about the physical switch.

CDP has been supported with vSphere Standard Switches for quite sometime now, but LLDP support was only added recently with the introduction of the vSphere Distributed Switch. Chris Wahl has a great article here on why you should enable either CDP/LLDP and the benefits you get with it. For customers who are running non-Cisco switches, lldpnetmap is a great way to quickly figure out which physical switch your ESXi hosts are connected to, especially useful during troubleshooting where every minute counts.

There are actually two ways in which you can run the lldpnetmap utility. The first method is by running it within the ESXi Shell using the following command:


The command takes about about 30-60 seconds to run and if successful, you should see the name of the physical network switch and the vmnic (pNIC) that they are connected to.

Here is a screenshot of what that output looks like:

The second method is actually how Christian had been using the command which is through RVC. Using the vsan.lldpnetmap command, you can specify an individual ESXi host or an entire vSphere Cluster. Even though the command is under the VSAN namespace, you do not need to have VSAN enabled to use the command.

Here is a screenshot of what that output looks like:

Note: If you do not see any output, you are most likely connected to a Cisco switch or to a non-managed switch that does not support LLDP.

This is one utility I will be sure to remember the next time I need to troubleshoot a networking issue. Thanks for sharing this handy tidbit Christian!

8 thoughts on “Quick Tip - lldpnetmap, a handy utility to map pNic to pSwitch on ESXi

      • Hi William,

        That is nice to know. We use in a lot of branch offices no cisco switches and vsphere is a standard edition because it’s enough features for us….
        But when I try the lldpnetmap command I see only the relation between network card in the ESX and the connected switch name NOT the connected port on the switch. It is normal? For us it’s also important to know the switch port we the cable is plugged in.

  1. This is great. Unfortunately it has limited usefulness as there is still no lldp support for vSphere standard switches.

    • P. Cruiser, I’m not sure why you would think vSphere standard switch would/should have advanced functionality like lldp.

      • VSS already has advanced functionality, but only CDP, not LLDP which makes no sense unless you enjoy vendor lock-in.

Thanks for the comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.