This guide provides detailed instructions on how to set up the Link Layer Discovery Protocol (LLDP) on a Proxmox server, enable additional protocols such as Cisco Discovery Protocol (CDP), and configure automated updates for network interface descriptions based on LLDP data.
Before starting, ensure that you have administrative access to your Proxmox server and are familiar with basic Linux command line operations.
For convenience, an automated installation script is available to set up everything described in this guide. This script installs lldpd, configures it, and sets up a cron job to update network interface descriptions automatically.
To use the automated install script, follow these steps:
-
Clone the repository to your Proxmox server: To get started, clone the repository from GitHub by running the following command:
git clone https://github.com/abdellbar1/ProxLLDPConfig.git cd ProxLLDPConfig -
Make the script executable:
chmod +x install.sh
-
Run the script as root:
sudo ./install.sh
This script handles all the configurations and setups automatically, enhancing your Proxmox server's network management capabilities with minimal manual intervention.
LLDP is not installed by default on Proxmox. You will need to install the lldpd package, which supports LLDP and other discovery protocols.
-
Update your package list:
sudo apt update
-
Install
lldpd:sudo apt install lldpd
After installation, configure lldpd to enable additional discovery protocols and set it to recognize specific interface patterns.
-
Open the
lldpddefault configuration file:sudo nano /etc/default/lldpd
-
Add or modify the following line to enable CDP and other protocols:
DAEMON_ARGS="-x -c -s -e"-x: Enable LLDP.-c: Enable CDP (Cisco Discovery Protocol).-s: Enable SONMP (Foundry Discovery Protocol).-e: Enable EDP (Extreme Discovery Protocol).
-
Save and close the file.
Restart the lldpd service to apply the changes:
sudo systemctl restart lldpdConfigure lldpd to monitor only interfaces that match a specific pattern, such as en* for Ethernet interfaces. This is especially useful in environments with multiple interface types where you want to target a specific subset.
-
Use
lldpclito configure the system to monitor interfaces that match theen*pattern. This command tellslldpdto apply its configuration only to interfaces whose names start withen.sudo lldpcli configure system interface pattern en* -
To verify that the interface pattern has been set correctly, you can display the current configuration of
lldpd:sudo lldpcli show configuration
This setup ensures that lldpd will focus on Ethernet interfaces (like eno0, ens2f1, etc.), which are typically used in server environments, and will ignore other types of interfaces that do not match the specified pattern.
Create a cron script that updates the network interface descriptions based on LLDP information.
-
Create a new script file: Open a terminal and use the following command to create a new script file:
sudo nano /usr/local/bin/update_interface_desc.sh
-
Paste the code from the
update_interface_desc.shfile, adjusting paths and commands as necessary. Here is a basic example of what the script might include: -
Make the script executable: Grant execute permissions to the script using the following command:
sudo chmod +x /usr/local/bin/update_interface_desc.sh
-
Edit the root's crontab: Access the cron job editor for the root user by executing:
sudo crontab -e
-
Add the following line to run the script every hour: Schedule the script to run at the start of every hour, and direct the output to a log file for later review:
0 * * * * /usr/local/bin/update_interface_desc.sh >> /var/log/update_interface_desc.log 2>&1
This setup ensures that your Proxmox server's network interface descriptions are regularly updated based on the latest LLDP data, enhancing network management and documentation.
