Concepts / Switches

Switches

CDP

Also called Cisco Discovery Protocol, show cdp neighbors

Cisco's own discovery protocol, on by default on every Cisco device.

The problem

Cisco devices announce themselves to their neighbours in Cisco's own format, which LLDP does not read.

  1. officeSwitch speaks CDP as well as LLDP, as a Cisco switch does by default.
  2. Every few seconds it sends a CDP frame to 01:00:0c:cc:cc:cc out of each port.
  3. The frame carries its Device-ID, address, the Port-ID, capabilities, software version and platform.
  4. A Cisco neighbour reads it with show cdp neighbors detail; on Linux, tcpdump -v decodes it.
A CDP frame goes one hop and no further
A CDP frame goes one hop and no further

A Cisco device describes itself in a frame to 01:00:0c:cc:cc:cc. The direct neighbour keeps it in a table and does not pass it on, so the table lists only what is plugged in next.

What you'd see

$ tcpdump -nn -v -i eth0 -c1 ether dst 01:00:0c:cc:cc:cc
19:07:35.642994 CDPv2, ttl: 20s, checksum: 0x1161 (unverified), length 97
	Device-ID (0x01), value length: 12 bytes: 'officeSwitch'
	Address (0x02), value length: 13 bytes: IPv4 (1) 10.0.1.13
	Port-ID (0x03), value length: 6 bytes: 'laptop'
	Capability (0x04), value length: 4 bytes: (0x00000019): Router, L2 Switch, L3 capable
	Version String (0x05), value length: 29 bytes:
	  Access switch, floor 2 closet
	Platform (0x06), value length: 5 bytes: 'Linux'
  • Recorded on the laptop's card.
  • Device-ID 'officeSwitch', Address 10.0.1.13, Port-ID 'laptop': the same facts LLDP gives.
  • Version String and Platform: the software and model. On a real Cisco switch that is the exact IOS version, which tells an attacker which bugs to try.

Guess first

officeSwitch is replaced by another vendor's switch that speaks only LLDP. What does the gateway, a Cisco router, show for that port in show cdp neighbors?

Show answer

Nothing: CDP is Cisco's own. The router needs lldp run to see the new switch, which is why mixed networks use LLDP.

In short

CDP (Cisco Discovery Protocol) is how Cisco devices tell their direct neighbours who they are. Each sends a frame to 01:00:0c:cc:cc:cc with its Device-ID, addresses, Port-ID, capabilities, platform and software version; the neighbour keeps it in a table and does not pass it on. It is on by default. LLDP is the open equivalent. show cdp neighbors detail reads the table; no cdp enable turns it off on a port.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab