Switches
LLDP
Devices announcing their name, port and addresses to whoever is at the other end of each cable.
The problem
Nothing on a cable says what is plugged into its other end.
- Every few seconds (30 by default) officeSwitch sends an LLDP frame, type
0x88cc, out of each port. - It holds TLVs, small labelled fields: the switch's name, the port's name, its management address, a time to live.
- The laptop keeps what it hears in a neighbour table, for as long as the time to live says, and announces itself back.
- The switch never passes LLDP on: the printer never hears the laptop's announcements. Each one reaches only the next device.
What you'd see
$ lldpcli show neighbors
Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:00:12
Chassis:
ChassisID: mac e6:ea:e6:9b:2b:4d
SysName: officeSwitch
SysDescr: Access switch, floor 2 closet
MgmtIP: 10.0.1.13
Capability: Bridge, on
Port:
PortID: mac e6:ea:e6:9b:2b:4d
PortDescr: laptop
TTL: 20
- Run on the laptop.
Interface: eth0, via: LLDP: heard on its card. SysName: officeSwitch,MgmtIP: 10.0.1.13: who is at the other end, and where to log in to it.PortDescr: laptop: the switch port its cable ends in.TTL: 20: forget this after 20 seconds without a new announcement (announcements every 5 s here).
Guess first
The laptop's cable is moved from officeSwitch to another switch. How long can its table still name officeSwitch?
Show answer
Up to the TTL, 20 seconds here (120 with default timers), unless the new switch's announcement replaces it first.
In short
Every few seconds (30 by default) each device sends an Ethernet frame of type 0x88cc to a multicast address that
switches keep to themselves, holding TLVs: chassis ID, port ID, time to live, then name, description, capabilities
and management address. Neighbours keep it in a table for its TTL; it never crosses a second hop. LLDP-MED adds
endpoint TLVs, among them the voice VLAN, priority and DSCP a phone should use. The same details are free
reconnaissance for anyone on an access port, so announcements are turned off where they serve nothing.
Read next
- CDP Cisco's own discovery protocol, on by default on every Cisco device.
- Switch Joins devices into one network, forwarding each frame toward the port its destination MAC was seen on.
- VLAN Several separate networks on one switch, kept apart by a tag in each frame.
- DSCP Six bits in the IP header that mark a packet's traffic class, such as EF (46) for voice.