Link Layer Discovery Protocol
by Alex on Feb.27, 2010, under Tinkergeek
Ever wondered exactly where all your network cabling goes? Have you been using Cisco and wished your computers spoke CDP too? Apparently you and everyone else would love for the computers to just say where they connected instead of chasing down network cables by hand. That seems to be the goal of the Link Layer Discovery Protocol (LLDP or 802.11ab). Unlike the Cisco Discovery Protocol (CDP), LLDP is the vender-neutral attempt to get it all right.
There is a LLDP daemon that is published at Luffy.cx that implements this under Linux. There are other daemons out there too, but this showed up first when I searched the Debian repositories for precompiled versions. Simply installing it via apt and starting up the service is enough to get your computers and your network devices discovering themselves. Although, if you’re like me and don’t have fancy new networking gear that supports LLDP, lldpd supports a wide range of other network discovery protocols too.
Once I installed lldpd on all my computers and enabled the CDP option (the -c option when starting up lldpd), I saw the magic happen:
c2950-01#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
ospf-01
Gig 0/1 107 R Linux eth1
home-1
Gig 0/2 114 Linux eth0
storage
Fas 0/15 106 Linux eth0
c831
Fas 0/8 146 R C831 Eth 2
c871
Fas 0/1 142 R S I 871 Fas 0
To query the neighbors discovered by lldpd on the computer side, lldpctl outputs all the current neighbors:
Interface: eth1 ChassisID: c2950-01 (local) SysName: c2950-01 SysDescr: cisco WS-C2950G-48-EI running on Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA8a, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2006 by cisco Systems, Inc. Compiled Fri 28-Jul-06 17:00 by weiliu MgmtIP: 172.0.0.0 Caps: Bridge(E) PortID: GigabitEthernet0/1 (ifName) PortDescr: GigabitEthernet0/1
To finish up the post, I’ll note that discovery protocols have in the past, and potentially still now, have been susceptible to attacks by flooding devices with too many neighbor relations. Because of this, it might be best to ensure these protocols are disabled on switches ports connected to untrusted machines.