HowTo Enable LLDP on Linux Servers for Link Discovery

Version 15

    This post simply shows what to do in order to enable LLDP on Linux server for link discovery purposes (Remote Monitoring).

    References

    Configuration

     

    Start with installing the lldp application. There are two options for that:

     

    Option 1: lldpad

     

    1. Install lldpad on the server:

      - For RHEL/CentOS

    # yum -y install lldpad

      - For Ubuntu

    # apt-get install lldpad

     

    2. Run the LLDP Daemon:

    # lldpad -d

     

    3. Run the following script:

    for i in `ls /sys/class/net/ | grep 'eth\|ens\|eno'` ;

          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

     

    For example:

    #  for i in `ls /sys/class/net/ | grep 'eth\|ens\|eno'` ;       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

     

    enabling lldp for interface: eth1

    adminStatus = rxtx

    enableTx = yes

    enableTx = yes

    enableTx = yes

    enableTx = yes

    enableTx = yes

     

    enabling lldp for interface: eth2

    adminStatus = rxtx

    enableTx = yes

    enableTx = yes

    enableTx = yes

    enableTx = yes

    enableTx = yes

     

    Note: for RHEL 7 the interface name doesn't contain "eth" but "enp"  (or similar) to the grep should be "grep enp".

     

    Note: in case you use lldpad and wish to pass the management address via LLDP TLV on specific interface, you need to add this specifically.

    Otherwise, only the hostname will pass via LLDP TLV.

     

    For example:

    # lldptool -T -i eth2 -V mngAddr ipv4=192.168.24.185

     

    Option 2: lldpd

    Another possible LLDP linux application is called lldpd (not lldpad)

    This version of LLDP doesn't require and specific configuration, it sends the TLVs by default. including the management address.

     

    - For RHEL/CentoOS

    There is no yum inventory For RHEL/CentOS for this application, need to download the install the rpm (there are several location on the web for that) and then to restart the application.

    Here is a link to download the llapd.

    # /etc/init.d/lldpd restart

      - For Ubuntu

    # apt-get install lldpad

    # /etc/init.d/lldpad restart

     

    - For Suse

    # lldp –m <IPv4 address>

     

    Once lldpad or lldpd are installed, make sure SNMP is running:

    # /etc/init.d/snmpd start

    Starting snmpd (via systemctl):                            [  OK  ]

     

    Make sure that the remote switch is enabled with lldp, If this is a Mellanox switch, simply run the command "lldp"

    switch (config) # lldp

     

    This is it: LLDP is enabled on your server and switch.

     

    Verification

     

    Here is a nice example with the Observium tool, refer to HowTo Monitor Mellanox Switches using Observium, in case you are using Mellanox switches.

     

    1. Make sure all servers and switches were added to the tool (it can be done simply from the GUI via "Add Device" button).

    2. Discover and poll the network

    # cd /opt/observium

    # ./discovery.php -h all

    #./poller.php -h all

     

    3. Go to Observium GUI and view the switch ports map - here is an example (two servers connected to the switch):

    map2.PNG.png

     

    If you don't run Observium, you can simply do it from the Mellanox switch MLNX-OS CLI:

    r-qa-sit-sx08 (config) # show lldp interfaces ethernet remote

    Eth1/51

    Remote Index: 1
    Remote chassis id: f4:52:14:17:1b:81 ; chassis id subtype: Mac Address (4)
    Remote port-id: f4:52:14:17:1b:81 ; port id subtype: Mac Address (3)
    Remote port description: Interface   4 as enp5s0
    Remote system name: reg-r-vrt-001
    Remote system description: Linux reg-r-vrt-001 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64
    Remote system capabilities supported:  ; enabled
    Remote Management Address: Not Advertised

    No Remote PFC entry

    Remote ETS configuration
    --------------------------------------
    Willing: enabled
    CBS: disabled
    Number of supported traffic classes: 0

    priority assignment table
    --------------------------------------
    Priority        TC
    --------------------------------------
    0       0
    1       0
    2       1
    3       1
    4       2
    5       2
    6       3
    7       3

    Traffic class bandwidth table
    -----------------------------------------------
    TC      Bandwidth       TSA
    -----------------------------------------------
    0       25      tsaEnhancedTransmission(2)
    1       25      tsaEnhancedTransmission(2)
    2       25      tsaEnhancedTransmission(2)
    3       25      tsaEnhancedTransmission(2)

    No Remote Application Priority entry


    Eth1/52

    Remote Index: 2
    Remote chassis id: f4:52:14:17:1f:e1 ; chassis id subtype: Mac Address (4)
    Remote port-id: f4:52:14:17:1f:e1 ; port id subtype: Mac Address (3)
    Remote port description: Interface   4 as enp5s0
    Remote system name: reg-r-vrt-002
    Remote system description: Linux reg-r-vrt-002 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64
    Remote system capabilities supported:  ; enabled
    Remote Management Address: Not Advertised

    No Remote PFC entry

    Remote ETS configuration
    --------------------------------------
    Willing: enabled
    CBS: disabled
    Number of supported traffic classes: 0

    priority assignment table
    --------------------------------------
    Priority        TC
    --------------------------------------
    0       0
    1       0
    2       1
    3       1
    4       2
    5       2
    6       3
    7       3

    Traffic class bandwidth table
    -----------------------------------------------
    TC      Bandwidth       TSA
    -----------------------------------------------
    0       25      tsaEnhancedTransmission(2)
    1       25      tsaEnhancedTransmission(2)
    2       25      tsaEnhancedTransmission(2)
    3       25      tsaEnhancedTransmission(2)

    No Remote Application Priority entry

    r-qa-sit-sx08 (config) #

     

     

    Troubleshooting

    It seems that there’s a problem with the latest rpm of version 1.0.1-3.

    You can verify your version by

    # rpm –qa | grep lldpad

    You can remove it by

    # yum remove lldpad

     

    and install a working version by running

    # yum install lldpad-1.0.1-2.git986eb2e.el7.x86_64