In this article we will try to go through CDP and also trough LLDP, how to configure for vSwitch, but also for vDS and how to check the information in vCenter provided by this feature.

This week we install new ESXi hosts from a remote location. Since we did not have access physically to the Switches/ESXi hosts and we need to double check if the cabling was correct, and also witch interface was connected to which switch port.

When you have your vCenter and all VMware Infrastructure installed, this is easy to enable and discover. By using CDP (for CISCO) or Link Layer Discovery Protocol (LLDP for HP, Juniper or others brands) Network teams can easily get this information, even we can check this in the vCenter (see images below).

Since this was a new installation(new Switches, ESXi hosts, etc.), there was no vCenter and also no Storage Network (we still need to check where and witch cables are connected). Since there was only one vSwitch created in the ESXi,  so I remember there was a way to configure this LLDP (we were using Juniper Switches) in the vSwitch using vsish command.

Different ways to grab Physical Switches vs Virtual Switches information :

Listen mode – The ESXi/ESX host detects and displays information about the associated Cisco switch port, but information about the vSwitch is not available to the Cisco Switch administrator.
Advertise mode – The ESXi/ESX host makes information about the vSwitch available to the Cisco switch administrator, but does not detect and displays information about the Cisco switch.
Both mode – The ESXi/ESX host detects and displays information about the associated Cisco switch and makes information about the vSwitch available to the Cisco switch administrator.

Note: Depending on your Network / Virtual environment you can choose any of this options. In our implementations, most are set with Both, but some we use Listen. So check with your Network Teams what is the best option for them (or for Virtual Administrators).

How to configure CDP in Standard Switch (vSS):

For vSS we need to this by ESXi shell command.

First check what type of mode is set (listen is by default), then enable mode (add your mode option).

To enable LLDP in a vSwith is a more complex.

Note: VMware doesn’t support LLDP in vSwitch, so please be careful using the next steps in Productions environments.

To enable this, we need to connect/read directly into the vSwitch with the command vsish.

Note: If you have more than one vSwitch already configured in your ESXi and want to enable LLDP in all vSwitch, you need to do the steps to all vSwtiches(one a the time)

We will use vSwitch0 to enable LLDP. Then we will go to the folder for ports in this vSwitch0 and list all the ports that are available.

Again, connect to your host in the ESXi Shell.

So in this vSwitch0 we have all these ports

33554433/
33554434/
33554435/
33554436/
33554437/
33554438/

Then we need to check witch port belong to witch vmnics (our ESXi Network Interfaces). To get the information from the vSwitch ports, we will use get status for each port.

Just run the command to each port to identify which ones are from the vmnics.

screen-shot-09-23-16-at-04-02-am

Since this port doesn’t match a vmnic, let’s check the next one.

screen-shot-09-23-16-at-04-03-am

As we can see in the highlight, this port belongs to vmnic0. So do the same for all ports and then we will enable the LLDP in the right ports.

In this case, these are the ports that were identified.

33554433 — management
33554434 — vmnic0
33554435 — shadow vmnic0
33554436 — vmnic9
33554437 — shadow vmnic9
33554438 — vmk0 (if you have any vmkernel in the vSwitch all will be displayed here as port)

So we need to enabled LLDP in port 33554434 and port 33554436. Because those are the physical ones, the rest is just virtual.

Enter the port folder and in the LLDP folder to enable LLDP.

Commands:

get enable – will provide the state of the LLDP (0 is disable, 1 is enable)
set enable 0/1 – is to enable or disable the LLDP

With this commands you can enable LLDP in your ports.

I found a shell script in the https://gist.github.com/  that do the same trick for all vmnics in the vSwtich. Thanks to AnthonyWC for this script.

After your vSwitches have all vmnics configured with LLDP, you can now check with Network Teams(or you own teams) the ports/interfaces connections.

Check in the next image where you can list the CDP / LLDP from the vSwitch using vSphere client (next section we can check how to see this trough vSphere Web Client).

lldp01

How to configure CDP/LLDP in vNetworking Distributed Switch (vDS):

Configuring CDP or LLDP in a vDS is much easier than in a vSS. Since we need vCenter o do this (vDS only works with vCenter ).

  • Using vSphere Client:
  1. Connect to vCenter Server using the vSphere Client.
  2. In the vCenter Server home page, click Networking.
  3. Right-click the vDS and click Edit Settings.
  4. Select Advanced under Properties.
  5. Using the checkbox and the dropdown, change the CDP settings.
  • Using vSphere Web Client:
  1. Connect to vCenter Server using the vSphere Web Client.
  2. In the vCenter Server home page, click Networking.
  3. Right-click the vDS and click Edit Settings.
  4. Select Advanced under Properties.
  5. Using the checkbox and the dropdown, change the CDP / LLDP settings.

lldp03

Check in the next image where you can list the CDP / LLDP from the vSwitch using vSphere Web client.

lldp02

Hope this information was useful.

Note: Share this article, if you think it is worth sharing.

©2017 ProVirtualzone. All Rights Reserved