-->

How to get CDP info on command line in Esxi host.


What is the CDP ?

The Cisco Discovery Protocol (CDP) is a Cisco's proprietary Data Link Layer protocol used to share information about other directly connected Cisco equipment, such as upstream Physical switch. CDP allows ESX and ESXi administrators to determine the vSwitch is connected to which Cisco switch port.

How to get CDP info on command line in Esxi host.

1. SSH enabled in esxi host.

2. Login ESXi host by using putty session. 

Run the below commands to get information.

Query info for all vmnics (all switch and VLAN info)

#vim-cmd hostsvc/net/query_networkhint

Query info for a single or some vmnics (all switch and VLAN info)

#vim-cmd hostsvc/net/query_networkhint --pnic-names=vmnic0
#vim-cmd hostsvc/net/query_networkhint --pnic-names=vmnic1,vmnic2

Query switch port connectivity info only for all vmnics

#vim-cmd hostsvc/net/query_networkhint |grep -E 'device\
=|devId|address|portId|mgmtAddr|location'

command output: 

Query switch port connectivity info only for single/ special vmnics

#vim-cmd hostsvc/net/query_networkhint --pnic-names=vmnic1,vmnic2|grep -E 'device\
=|devId|address|portId|mgmtAddr|location'


Command output

Check if VLANs are available on special vmnics (example for vmnic0)

#vim-cmd hostsvc/net/query_networkhint --pnic-names=vmnic0|grep vlanId

command output:
 vlanId = 900,
 vlanId = 1175,
 vlanId = 908,
 
If there are many VLANs tagged (e.g. VM Access VLANs), command output can be piped to "less" command

#vim-cmd hostsvc/net/query_networkhint --pnic-names=vmnic0|grep vlanId | less

===============================***======================
How to get CDP info on command line in Esxi host. How to get CDP info on command line in Esxi host. Reviewed by Virtulization on April 29, 2021 Rating: 5

No comments:

Home - PageNavi (show/hide)

hide
Powered by Blogger.