Installing LLDP on Ubuntu

Reading Time: 2 minutes

LLDP (Link Local Discovery Protocol) is an Open Standard Layer-2 protocol that is used by servers and network devices to advertise their identity and capabilities to other device, by directly connected devices. This standard is defined in IEEE 802.1AB. The information is sent via lldp-enabled interfaces, as Ethernet frame, over fixed interval. These frames contain LLDPDS (Link Local Discovery Protocol Data Unit) in a Type-Length-Value (TLV) format.

LLPDS include a wide range of information from hostname, description, and port name etc. Using LLPD can be very useful as you will be able to find out what devices are directly connected to a switch without having the joy of going cable tracking, and it’s useful for troubleshooting. With that in mind, this post will go into how you would enable LLDP on a Juniper and Cisco switch, and how to enable on Ubuntu 14.04LTS.

Let’s get cracking!

For my set up I’ve got ESXi host running Ubuntu 14.04LTS. It has three vNICs; one is connected to the OOB Cisco 3750G switch and other two connections go into a Virtual Chassis Juniper EX4200

Firstly enable lldp on your network device:

For a Juniper device set protocols lldp interface all and for a Cisco device lldp run or for CDP, under the interface you will need to run cdp enable (CDP is Cisco’s proprietary link discovery protocol)

You’ll need to install the LLDP and SNMP packages onto the server:

[email protected]:~$ sudo apt-get install lldpd snmp

You’ll need to start both of the processes to get them up and running:

[email protected]:~$ sudo service lldpd restart
[email protected]:~$ sudo service snmpd restart

Once you’ve started these you’ll have both enabled on your server, and you’ll have LLDP configured! Nice and simple 🙂

To confirm everything is working as expected, you can run a show command on switches and the server for verification:

On the Juniper EX4200 show lldp neighbors, shows the 2 server NICs connected to each member

show lldp neighbors
[email protected]> show lldp neighbors 
Local Interface    Parent Interface    Chassis Id          Port info          System Name
ge-0/0/2.0         -                   00:0c:29:4f:26:bb   eth1               km-vm1              
ge-1/0/2.0         -                   00:0c:29:4f:26:bb   eth2               km-vm1              
vme.0              -                   00:19:06:cd:8f:80   GigabitEthernet1/0/36 oob-sw0-10.lab

On the Cisco 3750G show lldp neighbors, show the 2 ESXi hosts connected using the switch for Out of Band.

show lldp neighbors g1/0/48
oob-sw0-10.lab#show lldp neighbors g1/0/48
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
km-vm2              Gi1/0/48       120                        000c.29d3.ac6d
km-vm1              Gi1/0/48       120                        000c.294f.26bb

On the server, lldpcli show neighbors, shows all Cisco and Juniper switches and the other ESXi host shared the OOB NIC

lldpcli show neighbors
[email protected]:~$ lldpcli show neighbors
LLDP neighbors:
Interface:    eth0, via: LLDP, RID: 1, Time: 0 day, 22:19:29
    ChassisID:    mac 00:0c:29:d3:ac:77
    SysName:      km-vm2
    SysDescr:     Ubuntu 14.04.2 LTS Linux 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64
    MgmtIP:       2001:41c1:4:8040:20c:29ff:fed3:ac6d
    Capability:   Bridge, off
    Capability:   Router, off
    Capability:   Wlan, off
    PortID:       mac 00:0c:29:d3:ac:6d
    PortDescr:    eth0
Interface:    eth0, via: LLDP, RID: 2, Time: 0 day, 22:19:11
    ChassisID:    mac 00:19:06:cd:8f:80
    SysName:      oob-sw0-10.lab
    SysDescr:     Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 15.0(1)SE, RELEASE SOFTWARE (fc1)
Technical Support:
Copyright (c) 1986-2011 by Cisco Systems, Inc.
Compiled Wed 20-Jul-11 09:32 by prod_rel_team
    Capability:   Bridge, on
    Capability:   Router, off
    PortID:       ifname Gi1/0/48
    PortDescr:    GigabitEthernet1/0/48
Interface:    eth1, via: LLDP, RID: 6, Time: 0 day, 00:02:58
    ChassisID:    mac 40:a6:77:5f:60:00
    SysName:      EX4200-A
    SysDescr:     Juniper Networks, Inc. ex4200-48t , version 12.3R5.7 Build date: 2013-12-18 03:01:12 UTC 
    Capability:   Bridge, on
    Capability:   Router, on
    PortID:       local 503
    PortDescr:    KM-VM-1
Interface:    eth2, via: LLDP, RID: 6, Time: 0 day, 00:03:01
    ChassisID:    mac 40:a6:77:5f:60:00
    SysName:      EX4200-A
    SysDescr:     Juniper Networks, Inc. ex4200-48t , version 12.3R5.7 Build date: 2013-12-18 03:01:12 UTC 
    Capability:   Bridge, on
    Capability:   Router, on
    PortID:       local 661
    PortDescr:    KM-VM-1

You can see detailed information and additional commands that can be run using lldpcli, on the man pages or via Ubuntu documentation

The following two tabs change content below.

Keeran Marquis

Network Engineer
Keeran Marquis is a Network Engineer. His main goal is to learn everything within the Networking field, pick up a little bit of scripting, be a poor man sysadmin and share whatever he knows! All Posts are his own views, opinions and experiences, no guarantees they will work for you but point you in the right direction 🙂
Share this:

3 thoughts on “Installing LLDP on Ubuntu”

  1. Vishal

    Pl provide a Windows or Linux program / script to find the H/W port of a switch (good if not vendor specific) a client is connected to (the script is to be run on the client). Client is unable to log into the switch (obviously!)

    1. Discus

      Linux, assuming you’ve followed the instructions above to enable lldpd and snmpd – *AND* the switches are all doing LLDP:

      lldpcli show neighbors | grep PortID | awk ‘{print $3}’

      will return the port number as given in LLDP TLV.

      You may want something more complex to catch errors, but that is a reasonable base to start scripting from.

  2. Cesar Flores

    Good information, any idea on how to get response on SNMP OID .1.0.8802. that suppose to be lldpRemSysName? I had installed lldpd and snmpd but no response at lldpRemSysName OID.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.