Advertising host details via LLDP on Debian/Ubuntu


Userlevel 3
LLDP operates using a "push" model, where the LLDP daemon advertises information about the local system and interface to a peer device. This is a great way to quickly verify what device is connected to each port. In Cumulus Linux, when there are many connections to hosts, LLDP helps in troubleshooting problems, assuming the hosts have the LLDP daemon running.

On your Debian and Ubuntu hosts, it is easy enough to install the LLDP daemon:
apt-get install lldpd
On our host now we can see which switchport the host is connected to:
root@lab7:~# lldpctl p1p1
------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: p1p1, via: LLDP, RID: 10, Time: 0 day, 12:53:20 Chassis: ChassisID: mac 44:38:39:00:32:cb SysName: sw13 SysDescr: Cumulus Linux version 2.5.8 running on dni et-7448bf MgmtIP: 10.10.1.13 Capability: Bridge, on Capability: Router, on Port: PortID: ifname swp1 PortDescr: MLAG Port to Compute1:p1p1 -------------------------------------------------------------------------------
From our Cumulus Linux switch, we can see the host connected to... Hmmm. That's odd. We only see a MAC address. This is not very helpful, unless you memorize the MAC addresses for each host:
root@sw13:~# lldpctl swp1  -------------------------------------------------------------------------------  LLDP neighbors:  -------------------------------------------------------------------------------  Interface:    swp1, via: LLDP, RID: 8, Time: 0 day, 12:51:03    Chassis:           ChassisID:    mac 90:e2:ba:5c:b5:a4    Port:              PortID:       mac 90:e2:ba:5c:b5:a4  -------------------------------------------------------------------------------
To get the same detailed output from lldpctl on the Cumulus switch, it requires a configuration change on the hosts, so they advertise the same detail Cumulus Linux does. When LLDPd is installed, the configuration file (/etc/lldpd.d/README.conf) is essentially empty. This is easily fixed, simply execute this command and restart the service:
sudo echo "configure lldp portidsubtype ifname" >> /etc/lldpd.d/README.conf  sudo systemctl restart lldpd.service
Now, when we look on the switch, the host's details are advertised:
root@sw13:~# lldpctl swp1
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface: swp1, via: LLDP, RID: 8, Time: 0 day, 12:51:03
Chassis:
ChassisID: mac 90:e2:ba:5c:b5:a4
SysName: lab7.rdu.cumulusnetworks.com
SysDescr: Ubuntu 14.04.4 LTS Linux 3.13.0-88-generic #135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016 x86_64
MgmtIP: 10.50.21.157
Capability: Bridge, off
Capability: Router, off
Capability: Wlan, off
Port:
PortID: mac 90:e2:ba:5c:b5:a4
PortDescr: p1p1
-------------------------------------------------------------------------------
That's all there is to it!

4 replies

Jason:

The config fails because the sudo applies to the echo not the file write:

$ sudo echo "configure lldp portidsubtype ifname" >> /etc/lldpd.d/README.conf
-bash: /etc/lldpd.d/README.conf: Permission denied

That line needs to be:
$ echo "configure lldp portidsubtype ifname" | sudo tee -a /etc/lldpd.d/README.conf

Userlevel 3
Hey David,
I originally did the echo as root, so it was not a problem for me. Thanks for the correction!
Userlevel 3
One more little thing I found in my tests; if you have the popular Intel x710 cards with newer/upgraded firmware, LLDP is meant to be handled directly on the NIC by default (in the firmware). Therefore it essentially filters out the LLDP PDUs on the NIC. However, you can work around the issue (under linux) using this command (as root):
echo lldp stop > /sys/kernel/debug/i40e//command
This apparently disables the LLDP server running in firmware. Now, how to make this persistent? I have not figured that out. I suppose worse case, you can use rc.local to issue the commands on boot. If you find any other bizarre hardware cases, please post them back here.
As we ran into the same issue, where the switch received incorrect information (incorrect MAC address) from the LLDP on the NIC, we configured LLDP through the OS and disabled LLDP on the NIC (Intel x710)

I have found a link which provides a script which disables LLDP on the NIC while booting.
https://github.com/LMAX-Exchange/i40e-lldp-agent

Reply