Commands / Interfaces and addresses

Interfaces and addresses

lldpcli

Also lldpd, lldp neighbors, cdp neighbors

Reads and sets lldpd: the LLDP and CDP neighbours heard on each card, and what this device announces.

lldpd announces the device on its cards and keeps what it hears from neighbours; lldpcli asks it. show neighbors lists one block per card with the neighbour's chassis, name and port; details adds every TLV, LLDP-MED's included. configure changes what is announced, live.

lldpcli command usage

lldpcli show neighbors [summary|details] [ports PORT]
lldpcli show interfaces | statistics | configuration
lldpcli configure ports PORT lldp status rx-and-tx|rx-only|tx-only|disabled
lldpcli update

Options

summary
name, chassis and port of each neighbour only
details
every TLV the neighbour sent
ports PORT
one card only
update
announce now instead of at the next interval

lldpcli examples

lldpcli show neighbors summary
Who is at the other end of each card.
lldpcli show neighbors details | grep -A5 'Network Policy'
The voice VLAN, priority and DSCP an LLDP-MED switch hands out.
lldpcli configure ports laptop lldp status rx-only
Stops announcing on one port, still listening there.

Reading the output

$ lldpcli show neighbors summary
Interface:    gateway, via: CDPv2
  Chassis:
    ChassisID:    local gateway
    SysName:      gateway
  Port:
    PortID:       ifname eth0
    PortDescr:    eth0
    TTL:          20
  • via: names the protocol the entry was heard over: LLDP, CDPv1 or CDPv2.
  • TTL: seconds left before the entry is forgotten unless a new announcement arrives.

Pitfalls

  • An entry stays until its TTL runs out: a neighbour that went quiet is still listed for a while.
  • lldpd skips virtual cards unless they are named with -I.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab