LLDP (Link Layer Discovery Protocol)
What it is for
Cables get plugged into the wrong port all the time, and the configuration cannot tell you what is on the other end.
★★★ LLDP has every device announce, periodically (30 seconds by default), on every port: "I am sw1, this is my G0/1". The far end records it, producing a neighbour table -- which is how management systems draw topology automatically.
Exactly one hop
★★★ The most important property: it reaches only directly connected neighbours and is never forwarded.
That is achieved with a reserved multicast destination, 01:80:c2:00:00:0e -- a switch seeing it knows "this is for me", consumes it and never sends it on.
★★ So sw2's neighbour table contains sw1 but not the server -- the server is not its direct neighbour.
★ Common misconceptions
★★★ "The TTL in the TLV is a hop count" -- it is not. It is an aging time in seconds: how long to keep this neighbour record without an update. LLDP has no notion of hops because it only ever goes one.
★★ "LLDP shows me the whole topology" -- each device knows only its own neighbours. The full picture comes from a management system stitching together everyone's tables.
★★★ "There is no risk in leaving it on" -- it broadcasts model, software version and management IP. On customer-facing or untrusted ports it should be turned off: it is free asset discovery for an attacker.