LLDP is a standard almost everywhere, unlike CDP that is mostly used only on Cisco devices.
From time to time I had to troubleshoot issues where is a ESXi (or ESX) server connected and if all the vlans are tagged correctly. Sometimes documentation is not accurate so we had to find where is connected based on some MAC addresses and other ways.
We know that VMware can receive LLDP uplinks information but they are “available” by default only for VDS (VMware vSphere Distributed Switch) and this was not our case.
We didn’t want to reinvent the wheel so we tried to find if someone had our problem as well. We found few tries here and here.
We learned from this and we created our version and I want to share it.
Currently is published on github.
For my demo, file is located in /tmp and is called lldp.sh. (be aware that you need CLI connection, normally via ssh to the server)
[root@localhost:/tmp] pwd
/tmp
[root@localhost:/tmp] ls -als
total 16
4 drwxrwxrwt 1 root root 512 Feb 20 12:01 .
4 drwxr-xr-x 1 root root 512 Feb 20 11:54 ..
4 -rwxrwxrwx 1 root root 3207 Feb 20 11:55 lldp.sh
4 -rw------- 1 root root 40 Feb 20 12:15 probe.session
[root@localhost:/tmp]
Running the file, it will change LLDP information in both ways. Means the other side (normally a physical switch) can see hostname and vmnic names where are connected but script will show also this directly into terminal.
[root@localhost:/tmp] ./lldp.sh vSwitch0 1
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554434
Local Port ID -> 2
Local Port -> vmnic0
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554436
Local Port ID -> 4
Local Port -> vmnic1
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554438
Local Port ID -> 6
Local Port -> vmnic2
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554440
Local Port ID -> 8
Local Port -> vmnic3
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554442
Local Port ID -> 10
Local Port -> vmnic4
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554444
Local Port ID -> 12
Local Port -> vmnic5
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554446
Local Port ID -> 14
Local Port -> vmnic6
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554448
Local Port ID -> 16
Local Port -> vmnic7
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
[root@localhost:/tmp] ./lldp.sh vSwitch0 1
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554434
Local Port ID -> 2
Local Port -> vmnic0
Remote Port -> Gi1/0/13
Remote Port Descr -> GigabitEthernet1/0/13
Remote Hostname -> switch0-1-fqdn
Remote Description -> Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), V
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554436
Local Port ID -> 4
Local Port -> vmnic1
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554438
Local Port ID -> 6
Local Port -> vmnic2
Remote Port -> Gi1/0/17
Remote Port Descr -> GigabitEthernet1/0/17
Remote Hostname -> switch0-1-fqdn
Remote Description -> Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), V
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554440
Local Port ID -> 8
Local Port -> vmnic3
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed
------------------------------
Trying to change LLDP state to 1..
Trying to map LLDP from ESXi to remote data..
ESXi Kerner Port: 33554442
Local Port ID -> 10
Local Port -> vmnic4
Remote Port ->
Remote Port Descr ->
Remote Hostname ->
Remote Description ->
clientType:port types: 4 -> Physical NIC
portCfg:
LLDP state successfully changed------------------------------
Sometimes you have to run this multiple times, is not instant.
Credits to Pekka “raspi” Jarvinen 2016 http://raspi.fi/ for the initial idea.