CentOS 7 - Link Layer Discovery Protocol (LLDP)


  1. Information
Called the IEEE 802.1AB Link Layer Discovery Protocol (LLDP), it is an emerging standard which provides a solution for the configuration issues caused by expanding LANs. LLDP specifically defines a standard method for Ethernet network devices such as switches, routers and wireless LAN access points to advertise information about themselves to other nodes on the network and store the information they discover. LLDP runs on all 802 media. The protocol runs over the data-link layer only, allowing two systems running different network layer protocols to learn about each other.

  1. Server
Install llpad.
[root@node1 ~]# yum -y install lldpad

Start the service and check the status.
[root@node1 ~]# systemctl start lldpad
[root@node1 ~]# systemctl status lldpad
  • lldpad.service - Link Layer Discovery Protocol Agent Daemon.
 Loaded: loaded (/usr/lib/systemd/system/lldpad.service; disabled; vendor preset: disabled
 Active: active (running) since Sat 20**-**-** 12:14:18 CET; 0h 1min ago
Main PID: 3923 (lldpad)
 CGroup: /system.slice/lldpad.service
     └─3923 /usr/sbin/lldpad -t

*** ** 12:14:18 node1.server.lab systemd[1]: Started Link Layer Discovery Protocol Agent Daemon..
*** ** 12:14:18 node1.server.lab systemd[1]: Starting Link Layer Discovery Protocol Agent Daemon....

[root@node1 ~]# systemctl enable lldpad
Created symlink from /etc/systemd/system/multi-user.target.wants/lldpad.service to /usr/lib/systemd/system/lldpad.service.
Created symlink from /etc/systemd/system/sockets.target.wants/lldpad.socket to /usr/lib/systemd/system/lldpad.socket.

[root@node1 ~]# systemctl is-enabled lldpad
enabled

Let's create a script to enable our interfaces for LLDP.
[root@node1 ~]# cd /opt
[root@node1 opt]# vi lldp.sh

# Add
#!/usr/bin/bash
#
for i in `ls /sys/class/net/ | grep enp` ;
 do echo "enabling lldp for interface: $i" ;
  lldptool set-lldp -i $i adminStatus=rxtx ;
  lldptool -T -i $i -V sysName enableTx=yes;
  lldptool -T -i $i -V portDesc enableTx=yes ;
  lldptool -T -i $i -V sysDesc enableTx=yes;
  lldptool -T -i $i -V sysCap enableTx=yes;
  lldptool -T -i $i -V mngAddr enableTx=yes;
done

Let's run the script.
[root@node1 opt]# sh lldp.sh
enabling lldp for interface: enp6s0
adminStatus = rxtx
enableTx = yes
enableTx = yes
enableTx = yes
enableTx = yes
enableTx = yes


  1. Cisco switch

Enable LLDP.
switch# configure terminal
switch(config)# lldp run
switch(config)# lldp tlv-select port-vlan
switch(config)# lldp tlv-select management-address
switch(config)# lldp tlv-select system-capabilities
switch(config)# lldp tlv-select system-description
switch(config)# lldp tlv-select system-name
switch(config)# exit
switch# 

Check your neighbors.
switch# show lldp neighbors
Capability codes:
  (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
  (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other

Device ID   Local Intf   Hold-time   Capability   Port ID
node1    Gi0/7    116     S      68**.****.f421

Total entries displayed: 1

Detail information on one of our neigbors.
switch# show lldp neighbors GigabitEthernet 0/9 detail
-----------------------------------------------
Chassis id: 68**.****.f421
Port id: 68**.****.f421
Port Description: Interface    6 as enp6s0
System Name: node1.server.lab

System Description:
Linux node1.server.lab 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue *** * 23:06:41 UTC 20** x86_64

Time remaining: 113 seconds
System Capabilities: S
Enabled Capabilities: S
Management Addresses:
  IP: 10.0.6.30
Auto Negotiation - not supported
Physical media capabilities - not advertised
Media Attachment Unit type - not advertised
Vlan ID: - not advertised

Total entries displayed: 1

LLDP traffic information.
switch# show lldp traffic

LLDP traffic statistics:
  Total frames out: 808946
  Total entries aged: 0
  Total frames in: 163028
  Total frames received in error: 0
  Total frames discarded: 0
  Total TLVs discarded: 0
  Total TLVs unrecognized: 0

LLDP computational errors and overflows.
switch# show lldp errors

LLDP errors/overflows:
  Total memory allocation failures: 0
  Total encapsulation failures: 0
  Total input queue overflows: 0
  Total table overflows: 0


  1. Test LLDP from server.

Get LLDP neigbors and TLV information.
[root@node1 ~]# lldptool -i enp6s0 -t -n
Chassis ID TLV
  MAC: 6c:**:**:**:01:00
Port ID TLV
  Ifname: Gi0/7
Time to Live TLV
  120
System Name TLV   switch.server.lab
System Description TLV
  Cisco IOS Software, C2960 Software (C2960-UNIVERSALK9-M), Version 1*.0(*)SE***, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2016 by Cisco Systems, Inc.
Compiled Thu 03-Nov-16 13:52 by prod_rel_team
Port Description TLV
  GigabitEthernet0/7
System Capabilities TLV
  System capabilities: Bridge, Router
  Enabled capabilities: Bridge
Management Address TLV
  IPv4: 10.0.6.33
  System port number: 6
Port VLAN ID TLV
  PVID: 6
MAC/PHY Configuration Status TLV
  Auto-negotiation supported and enabled
  PMD auto-negotiation capabilities: 0x6c01
  MAU type: 1000 BaseTFD
End of LLDPDU TLV

LLDP statistics.
[root@node1 ~]# lldptool -i enp6s0 -S
Total Frames Transmitted = 8351
Total Discarded Frames Received = 0
Total Error Frames Received = 0
Total Frames Received = 8381
Total Discarded TLVs = 0
Total Unrecognized TLVs = 0
Total Ageouts = 0

1 opmerking: