2.1.b (i) CDP, LLDP

Section 2.1.b (i) CDP, LLDP

 

CDP:
We will start this discussion with the Cisco Discovery Protocol (CDP), a proprietary protocol invented by Cisco for finding directly connected device information.

CDP is encapsulated in 802.3 Ethernet not Ethernet II.

This feature is enabled by default and transmits every 60 seconds with a hold/expire time of 180 seconds for cache info.

CDP messages go out as layer 2 multicast and is encapsulated in SNAP (thus looks a little strange in a packet capture).
CDP CANNOT be routed and CDP CANNOT traverse a directly connected link (even layer 2), it can only go 1 L2 hop.

To view general information about CDP timers and version use:
show cdp

Since CDP is enabled by default we have the option of turning it off per interface via :
no cdp enable

We can also turn it off globally via:
no cdp run

We can change CDP timers via:
cdp timer <sec>
cdp holdtime <sec>

The most common CDP command is the neighbors parameter for viewing the directly connected neighbors:
show cdp neighbors

For even more detail one can utilize:
show cdp neighbors detail
or
show cdp neighbors g0/1 detail

CDP can give us information on:
Device type
MGMT atresses
Platform
directly connected interface
duplex of directly connected interface
IOS version
CDP version
VTP domain
native vlan

LLDP:
LLDP came second, it was the answer to CDP. The LLDP standard, IEEE 802.1AB works very similarly. LLDP uses ethernet as the transport by default.

The ethetype for LLDP is 0x0x88cc.

LLDP packets are sent to the MAC of 01:8080:c2:00:00:0e (L2 multicast).

LLDP works only for directly connected interfaces and will not be forwarded (just like CDP).

LLDP is NOT enabled by default, thus needs to be enabled globally.
conf t
lldp run
int g0/1

Although not necessary, we have interface specific commants to prevent receive or transmit on certain ports once we have it enabled globally:
int g0/1
lldp transmit
lldp receive

The timers available to tune are:
lldp holdttime – how long to wait before an lldp message expires
lldp timer – how long to wait before retransmitting an lldp message
lldp reinit – how long to wait after an interface comes up to transmit the first message

conf t
lldp timer 5
lldp reinit 1
lldp holdtime 30

Note:
Note, if you’d like to use “switchport voice vlan x” with LLDP-MED you need to enable the MED-TLV “network-policy”.

Source:
Here is a good packet capture of CDP and LLDP via packetlife.net

http://packetlife.net/captures/LLDP_and_CDP.cap
https://wiki.wireshark.org/CDP