Installation

lldpd supports several OS. You can install it from packages or from sources. Once installed, you may want to look how to use and configure it.

GNU/Linux

Debian and Ubuntu

lldpd is already available in Debian and Ubuntu. You can install it with:

$ sudo apt-get install lldpd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
[...]

It will be installed and configured to start at boot. You can change the options of lldpd in /etc/default/lldpd.

If the package is not recent enough, you can use the Debian backports on Debian. Follow the instructions available on the website.

If it is still not recent enough, you can grab the appropriate Debian package from openSUSE Build Service. Follow the instructions available on the website.

The last option is to to build lldpd from source. You can still install and uninstall the package to get _lldpd user and group, as well as a working init script.

Gentoo

lldpd is available in portage. Just issue the command emerge lldpd to install it. You can also build lldpd from source.

Fedora, RHEL, CentOS

lldpd is available in the main Fedora and RHEL 8 repositories. Just issue the command dnf install lldpd to install it.

For older distro versions, like RHEL 7, it is available from the EPEL repository. In this case, you need to install the epel-release package before issuing the yum install lldpd command.

Once the lldpd package is installed, you can change its options via the /etc/sysconfig/lldpd file.

Alternatively, you can install the packages from openSUSE Build Service. Follow the instructions available on the website.

It is also possible to build lldpd from source.

SUSE

On SLES 12, openSUSE Leap 42.3 or openSUSE Tumbleweed, lldpd is available directly with the following command:

$ sudo zypper install lldpd
The following 11 NEW packages are going to be installed:
  libbsd0 libdb-4_8 libevent-2_0-5 libgdbm4 liblldpctl4 libsensors4 libsnmp30 libwrap0 lldpd perl snmp-mibs

11 new packages to install.
Overall download size: 8.7 MiB. Already cached: 0 B. After the operation, additional 47.8 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
[...]
(11/11) Installing: lldpd-0.9.9-2.1.x86_64 ...............[done]

It is also possible to build lldpd from source.

Docker

You can use Docker to run lldpd:

$ docker run --rm --net=host --uts=host \
           -v /etc/os-release:/etc/os-release \
           --cap-add=NET_RAW --cap-add=NET_ADMIN \
           --name lldpd \
           ghcr.io/lldpd/lldpd:latest

In place of latest which provides you with the latest stable version, you may use 1, 1.0, 1.0.18 to match specific versions.

To execute lldpcli, use:

$ docker exec lldpd lldpcli show neighbors

Or to get the command-line:

$ docker exec -it lldpd lldpcli

BSD

lldpd is currently available in the ports tree of most BSDs1. Follow the instructions on how to install lldpd from ports by following the documentation specific to the respective ports tree.

Some BSDs provide up-to-date binary packages using their respective package management tools.

Though if you want to build lldpd from source. You can add _lldpd user with vipw and add _lldpd group by adding it manually in /etc/group. The user must not be able to login, have its home as /var/empty and a disabled shell (like /bin/false).

You may want to configure lldpd with --with-privsep-chroot=/var/empty to avoid to create /var/run/lldpd.

If lldpcli is not able to provide completion, you can use the help command instead or install the GNU Readline library on your system.

macOS

The easiest way is to use the installer package for macOS. You need at least macOS 10.6.

Alternatively, you can use Homebrew. Check the website if you don’t have it, it is easy to install. Once installed, type in a terminal:

$ brew install https://raw.github.com/lldpd/lldpd/master/osx/lldpd.rb
######################################################################## 100.0%
==> Downloading https://media.luffy.cx/files/lldpd/lldpd-1.0.18.tar.gz
==> ./configure --prefix=/usr/local/Cellar/lldpd/1.0.18 --with-xml --with-readline
[...]

Pay attention at the instructions at the end of the build: they explain how to create _lldpd user and group and how to run lldpd when the system starts.

At least, you can build lldpd from source.

Install from source

This is the last resort method. Other methods are usually simpler. You need a working build environment.

First, download the tarball archive:

$ curl -sO https://media.luffy.cx/files/lldpd/lldpd-1.0.18.tar.gz
$ curl -sO https://media.luffy.cx/files/lldpd/lldpd-1.0.18.tar.gz.gpg
$ curl -s  https://media.luffy.cx/files/gpg.txt | gpg --import
gpg: key 95A42FE8353525F9: "Vincent Bernat <bernat@luffy.cx>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
$ gpg --verify lldpd-1.0.18.tar.gz.gpg lldpd-1.0.18.tar.gz
gpg: Signature made Fri Nov 11 14:31:37 2022 CET
gpg:                using RSA key AEF2348766F371C689A7360095A42FE8353525F9
gpg: Good signature from "Vincent Bernat <bernat@luffy.cx>" [ultimate]

Then, extract and build:

$ tar zxvf lldpd-1.0.18.tar.gz
$ cd lldpd-1.0.18
$ mkdir build
$ cd build
$ ../configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
[...]
------------------ Summary ------------------
 lldpd version 
  Prefix.........: /usr/local
  C Compiler.....: gcc -g -O2 -fdiagnostics-show-option -std=gnu99 -pipe -Wall -W -Wextra -Wformat -Wformat-security -Wcast-align -Winline -fstack-protector -D_FORTIFY_SOURCE=2 -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare 
  Linker.........: /usr/bin/ld -m elf_x86_64  -Wl,-z,relro -Wl,-z,now 
  Libevent.......: system
 Optional features:
  SNMP support...: no
  CDP............: yes
  FDP............: yes
  EDP............: yes
  SONMP..........: yes
  LLDPMED........: yes
  DOT1...........: yes
  DOT3...........: yes
  XML output.....: no
---------------------------------------------

Check the above options and compile with:
 make

If this steps fail, feel free to file a bug report. The content of config.log should be helpful. Otherwise, check if everything is as you expect and continue.

$ make
  CC     strlcpy.lo
  CCLD   libcompat.la
  CC     log.lo
[...]
make[1]: Leaving directory `/home/bernat/src/lldpd-1.0.18'

If this steps fail, feel free to file a bug report too with the output and some details on your platform. The config.log is also useful in this case.

You can finish the installation with make install. Then, you still have to complete the following steps by yourself. They are system specifics:

../configure accepts several options. You can get them with ../configure --help. The most interesting ones are --with-snmp and --with-xml.


  1. It has been added to the ports tree of OpenBSD (net/lldpd), FreeBSD (net-mgmt/lldpd) and NetBSD’s pkgsrc (net/lldpd). DragonFly uses the FreeBSD port with an overlay named DeltaPorts.