CDP and LLDP are discovery protocols that allow devices (or hosts in the case of ESXi) to share network information with the networking equipment they are connected to. Discovery protocols are most commonly used between switches and routers, but can also be configured on an ESXi host. CDP stands for Cisco Discovery Protocol, and is Cisco proprietary, whilst LLDP stands for Link Layer Discovery Protocol and is an open standard. Both protocols perform similar functions, and the choice between the two generally comes down to which protocol the physical networking equipment supports and is configured to use.
- Cisco Discovery Protocol (CDP) can be used on standard and distributed vSwitches which are connected to Cisco network equipment.
- Link Layer Discovery Protocol (LLDP) can be used on dvSwitches that are version 5.0 or later. LLDP is vendor neutral.
On a standard vSwitch you can view CDP information by clicking on the ‘speech’ icon next to the physical adapters:
Configuring Cisco Discovery Protocol (CDP) on ESXi Hosts
CDP is enabled by default on standard vSwitches, though you can view and configure CDP status using command line tools.
CDP can be disabled or configured on a per vSwitch basis. If it is enabled, it will be running in one of three possible modes:
- Listen – When in listen mode the host will display information about the physical switch it is connect to, but will not send CDP data, so CDP information on the vSwitch will not be available on the physical switch.
- Advertise – In this mode, the host will send CDP information to the physical switch, but will not display any information about the physical switch. Therefore this is the opposite of the listen mode.
- Both – When Both is set as the mode the host both receives/displays CDP data and sends CDP to the physical switch.
To view the CDP status for a vSwitch you can run:
~ # esxcfg-vswitch vSwitch0 -b listen
To change the mode that CDP is running in you can run:
~ # esxcfg-vswitch vSwitch0 -B both
Using ‘both’ as the mode in the example above means that CDP on that vSwitch will both listen for and advertise CDP information. The following segment from the help file shows the possible CDP modes that can be set:
-B|--set-cdp Set the CDP status for a given virtual switch. To set pass one of "down", "listen", "advertise", "both". -b|--get-cdp Print the current CDP setting for this switch.
You can also view and change the status using ESXCLI. For example, to set the CDP status to ‘both’, you can run the following:
~ # esxcli network vswitch standard set --cdp-status=both -v vSwitch0
And to view CDP status for a vSwitch you can run:
~ # esxcli network vswitch standard list vSwitch0 Name: vSwitch0 Class: etherswitch Num Ports: 128 Used Ports: 5 Configured Ports: 128 MTU: 1500 CDP Status: both Beacon Enabled: false Beacon Interval: 1 Beacon Threshold: 3 Beacon Required By: Uplinks: vmnic1, vmnic0 Portgroups: vMotion, Management Network
CDP Configuration on a dvSwitch
Configuring Link Layer Discovery Protocol (LLDP) on ESXi Hosts
LLDP is available only on distributed switches. It is configured in the Advanced settings of the dvSwitch:
As with CDP, there are the different modes of operation (Listen, Advertise and Both) or LLDP can be disabled entirely.