lldpctl
Show LLDP information about neighbors
TLDR
Start the lldp daemon
Display collected neighbor data
Display help
SYNOPSIS
lldpctl [ OPTION... ] [ COMMAND [ ARGUMENT... ] ]
PARAMETERS
-f <format>, --format <format>
Specifies the output format for displayed information. Supported formats include plain (default human-readable), xml, json, and keyvalue. This is particularly useful for scripting and programmatic access.
-d <socket>, --daemon <socket>
Connects to the lldpd daemon via a specified Unix domain socket path instead of the default location (usually /var/run/lldpd.socket).
-i <interface>, --interface <interface>
Applies the subsequent command or query to a specific network interface. If not specified, commands typically apply globally or to all relevant interfaces configured by lldpd.
-p, --permanent
Used with configure commands to make changes persistent across daemon restarts. This usually involves writing the configuration to a designated configuration file (e.g., /etc/lldpd.conf).
-v, --version
Displays the version information for the lldpctl utility and exits.
-h, --help
Displays a brief help message with common options and commands, then exits.
show
Displays LLDP information from the daemon. This command has several sub-commands, including neighbors (to list connected devices), interfaces (to show interface status), lldp (for general LLDP protocol status), configuration (current daemon settings), and statistics.
configure
Modifies the lldpd daemon's configuration. This command also requires sub-commands to specify what to configure, such as system (for host description, name, capabilities), interface (to enable/disable LLDP on a port or set its description), lldp (for protocol timers), med (for LLDP-MED specific parameters), and dot1 (for 802.1 related settings like VLANs).
watch
Monitors LLDP events and displays changes in real-time. This can be useful for troubleshooting or observing network topology dynamics as neighbors appear, disappear, or change attributes.
exit
Exits the interactive lldpctl shell. This command is only relevant when lldpctl is run without arguments, entering its interactive mode.
DESCRIPTION
The lldpctl command is a client utility used to interact with the lldpd daemon, which implements the Link Layer Discovery Protocol (LLDP). LLDP is a vendor-neutral Layer 2 protocol used by network devices to advertise their identity, capabilities, and other network-related information to directly connected neighbors on a local area network (LAN).
lldpctl allows users to query detailed information about discovered LLDP neighbors, such as their system name, port ID, capabilities (e.g., router, switch, AP), VLAN assignments, and more. It also provides functionality to configure various aspects of the lldpd daemon, including system-wide parameters, interface-specific settings, and LLDP protocol timers. This command is invaluable for network administrators to quickly map out network topology, troubleshoot connectivity issues, and verify network configurations.
CAVEATS
lldpctl acts as a client to the lldpd daemon; therefore, the daemon must be running for lldpctl to function. Many configure commands and certain information queries may require root privileges or appropriate permissions to execute successfully or to access sensitive network information.
INTERACTIVE MODE
Running lldpctl without any arguments or commands will launch an interactive shell. This shell provides a command-line interface similar to network device CLI environments, allowing users to issue multiple commands consecutively without retyping lldpctl each time. Tab completion is often available in this mode, enhancing usability and reducing command-line errors.
SCRIPTING AND AUTOMATION
The support for json and xml output formats makes lldpctl an excellent tool for scripting and automating network discovery tasks. Parsable output allows external programs to easily consume LLDP neighbor information for network inventory, monitoring, or configuration management systems, facilitating integration into larger network management solutions.
HISTORY
The lldpd project, including the lldpctl utility, was initiated by Vincent Bernat around 2008. It was designed to be a robust, portable, and feature-rich LLDP daemon for Unix-like operating systems. Its development aimed to provide a comprehensive tool for network topology discovery and management, filling a gap for a reliable open-source LLDP implementation. Over the years, it has gained widespread adoption in various Linux distributions and embedded systems due to its reliability and rich feature set.