natjohan's blog

Posted lun. 28 janvier 2013

Tip of the week 6

Know your network neighbors thanks to lldpd daemon

This week, i would like to present you lldpd. Actually, it's a useful daemon for GNU/Linux, BSD, Mac OS X developped by Vincent Bernat. The picture above summarizes the situation very well ;-).

Actually, this tool is a 802.1ab implementation (LLDP) to help you locate neighbors of all your equipments.. Thanks to this tool, you can discover your network neighbors (if they use LLDP/CDP/EDP/SONMP/FDP protocols) and advertise capabilities/identities of your network interfaces.

Installation & usage

lldpd is well documented, so you I can only advise you to read this documentation and follow the instructions to install it on your system.

Then you can use lldpctl or lldpcli (this one provide an interactive shell) to watch your network neighboors (pssst, there is a -f option for format, you can choose xml or json, it's very interesting for your script/backend UI) and configure your interfaces. The lldpd command allow you to debug/manage lldpd daemon.

RTFM now !

Example of output for lldpcli -> show neighbor detail (from the official doc):

# show neighbors detail
Interface:    eth0, via: LLDP, RID: 1, Time: 0 day, 00:00:10
    ChassisID:    mac 00:18:f3:03:4e:06
    SysDescr:     Debian GNU/Linux 7.0 (wheezy) Linux 3.7-trunk-amd64 #1 SMP Debian 3.7.1-1~experimental.1 x86_64
    Capability:   Bridge, on
    Capability:   Router, on
    Capability:   Wlan, off
    PortID:       mac ea:b8:ab:aa:8c:da
    PortDescr:    eth1
    PMD autoneg:  supported: no, enabled: no
      MAU oper type: 10GigBaseR - R PCS/PMA, unknown PMD.
    Device Type:  Media Endpoint (Class II)
    Capability:   Capabilities
    Capability:   Policy
    Capability:   Location
    Capability:   MDI/PSE
    Capability:   MDI/PD
    Capability:   Inventory
      Hardware Revision: System Version
      Software Revision: 3.7-trunk-amd64
      Firmware Revision: 2104
      Serial Number: System Serial Number
      Manufacturer: System manufacturer
      Model:        System Product Name
      Asset ID:     Asset-1234567890

So i think this tool is very useful to simplify your data-center configuration

Go Further

LLDP on wikipedia

Category: ToTW
Tags: tip linux lldpd lldp cdp network