This article will discuss the neighbor discovery protocols that can be used on Cisco devices. These are the Cisco discovery protocol (CDP) and link layer discovery protocol (LLDP).

The focus of the article will be on CDP overview information and configuration, but there will be information and configuration steps for LLDP as well.

The purpose of these protocols is to advertise information about the system’s identities and capabilities.

While CDP is, as the name suggest, a Cisco proprietary protocol and can be used only on Cisco devices, LLDP is the standard protocol and can be used for interworking between different network vendors.

To pass the CCNA exam, you need to know only CDP with regards to discovery protocols. But it is always good to go beyond and above what is required in the exam topics. You might find yourself in the situation where you have to monitor and configure a multi-vendor network. LLDP knowledge will come in handy in that situation.

We will use the topology below in the case study of configuring and troubleshooting CDP and LLDP:

CDP is used to discover the directly connected neighboring devices, the IP addresses, and other information, such as platform type and the software of those devices.

CDP is a Layer 2 protocol that is runs on all media that support SNAP (subnet access protocol). This means that it is supported on Ethernet, frame relay, and ATM mediums.

CDP version 2 is the latest release of the protocol. Compared to version 1, it provides enhancements regarding the reporting of various configuration errors of the two neighbor devices, such as native VLAN mismatch and duplex mismatch.

Every CDP-enabled device sends periodic advertisements to a multicast destination address: 01-00-0c-cc-cc-cc. Because this is a multicast address, any CDP-enabled device will process the frame. Among other important information in each advertisement, the device sends a hold time. This interval instructs the receiving device how long to keep the CDP information before declaring that the neighbor is dead. Each time a new advertisement is received, the hold time is reset to the value found in the periodic advertisement.

The power of CDP is represented by the information contained in the CDP advertisements as TLV (Type-Length-Value). These TLVs describes what information about the sending device is sent over a CDP-enabled interface.

Below are the most important TLVs and a short description:

TLV

Description

Device ID

Describes the device name

Addresses

Describes the IP address of the sending and receiving device

Port ID

Describes the port over which the CDP packet is sent

Capabilities

Describes the capabilities of the device

Software version

Describes the software version

Platform

Describes the hardware platform

VTP management domain

Describes the VTP domain name

Native VLAN

Describes the native VLAN per

Duplex

Describes the duplex configuration of interfaces when it is applicable

By default, CDP version 2 is enabled on all Cisco devices, on all interfaces. As expected, there are some default values regarding the advertisement timer and hold time timer. These are 60 seconds and 180 seconds. This means that if a device doesn’t hear anything for 180 seconds from the CDP neighbor, then that device is removed from CDP table as a CDP neighbor.

Now that we have some information about CDP and how is it working, it’s time to go further with the configuration and the monitoring.

The most basic command to check the advertisement interval, the hold time interval and the version of CDP is by using “show cdp”:

SW-1#show  cdp 
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#

To list all the CDP neighbors, altogether with some basic information about them, you can the “show cdp neighbors’ command:

SW-1#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  	S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  	D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     	Holdtme    Capability	  Platform  	Port ID
SW-3             Gig 8/11          	121              S I   		WS-C3750G 	Gig 1/0/11
SW-2             Gig 8/3           	163             R S I  	WS-C3750G	 Gig 1/0/3
SW-1#

As I said, this is giving you basic information, but most of the time it is enough to understand what the topology of the network is.

So let’s analyze the output of this command.

Remember, this is from the perspective of SW-1 based on the information that it received from both SW-2 and SW-3.

Device ID—is the hostname of the neighbor device

Local Intrfce—local interface over which the CDP information was received

Holdtme—the hold time value

Capability—the capability advertised by the neighbor

Platform—the platform type of the neighbor

Port ID—is the interface of the neighbor over which the neighbor has sent the CDP advertisement

So, looking at the topology and the output, we can confirm that SW-1 has interface Gi8/1, which is connected to SW-3. The time left during which the information regarding SW-3 will be kept by SW-1 is 121 seconds. SW-3 is a switch and also has IGMP capability. The platform is Cisco 3750 and the interface on SW-3 connected to SW-1 is Gi1/0/11.

If you need detailed information about the neighbors, then the command “show cdp entry *” will display the information about all neighbors. This can be restricted to specific neighbors like this:

SW-1#show cdp entry SW-3           
-------------------------
Device ID: SW-3
Entry address(es): 
  IP address: 10.10.10.3
Platform: cisco WS-C3750G-24TS-1U,  Capabilities: Switch IGMP 
Interface: GigabitEthernet8/11,  Port ID (outgoing port): GigabitEthernet1/0/11
Holdtime : 175 sec

Version :
Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 15.0(2)SE1, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Fri 04-Jan-13 02:26 by prod_rel_team

advertisement version: 2
Protocol Hello:  OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF000000000000F4ACC105D200FF0000
VTP Management Domain: 'DOMAIN-VTP'
Native VLAN: 1
Duplex: full
Management address(es): 
  IP address: 10.10.10.3

SW-1#

You cannot get more than this. Now we have complete information about the SW-3 neighbor. The additional information found using this command is:

  • Management IP address—10.10.10.3
  • The software that is running on SW-3—15.0(2)SE1
  • The CDP version—2
  • The VTP domain—DOMAIN-VTP
  • Native VLAN—1
  • Duplex—full

The same detailed information about SW-3 you could have gotten by using the command “show cdp neighbors gi8/11 detail”.

To find out if the device is sending and receiving CDP packets, “show cdp traffic” can be used to check the CDP counters:

SW-1#show  cdp traffic 
CDP counters :
        Total packets output: 522979, Input: 339899
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0, 
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 522979, Input: 339899
SW-1#

Sometimes it might be necessary to clear the counters or the CDP table. This can be done by using the commands “clear cdp counters” and “clear cdp table”:

SW-1#show cdp traffic                 
CDP counters :
        Total packets output: 523009, Input: 339910
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0, 
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 523009, Input: 339910
SW-1#clear cdp counters
SW-1#show cdp traffic  
CDP counters :
        Total packets output: 0, Input: 0
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0, 
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 0, Input: 0
SW-1#show cdp traffic 
CDP counters :
        Total packets output: 7, Input: 2
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0, 
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 7, Input: 2
SW-1#	

SW-1#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  	S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  	D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     	Holdtme    Capability	  Platform  	Port ID
SW-3             Gig 8/11          	126              S I   		WS-C3750G 	Gig 1/0/11
SW-2             Gig 8/3           	168             R S I  	WS-C3750G	 Gig 1/0/3
SW-1#
SW-1#clear cdp table     
SW-1#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  	S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  	D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     	Holdtme    Capability	  Platform  	Port ID
SW-3             Gig 8/11          	0                  S I   		WS-C3750G 	Gig 1/0/11
SW-2             Gig 8/3           	0                R S I  	WS-C3750G	 Gig 1/0/3
SW-1#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  	S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  	D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     	Holdtme    Capability	  Platform  	Port ID
SW-1#

As you can see, right after we cleared the CDP table, the hold time was set to 0, meaning that the entries should be removed from CDP table. However, because the SW-2 and SW-3 still send CDP advertisements, the CDP table will be rebuilt with the same information.

If CDP is enabled by default, how do you disable it? Or how do you change the default parameters?

This is how you disable it globally:

SW-1#show cdp 
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW-1(config)#no cdp run
SW-1(config)#end
SW-1#show cdp 
% CDP is not enabled
SW-1#

How about disabling it per interface?

SW-1#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     	Holdtme    Capability	  Platform  	Port ID
SW-3             Gig 8/11          	126              S I   		WS-C3750G 	Gig 1/0/11
SW-2             Gig 8/3           	168             R S I  	WS-C3750G	 Gig 1/0/3
SW-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW-1(config)#int gi8/11
SW-1(config-if)#no cdp enable
SW-1(config-if)#end
SW-1#

Let’s check both interfaces, gi8/11 and gi8/3:

SW-1#show  cdp  interface gi8/11

SW-1#show  cdp  interface gi8/3 
GigabitEthernet8/3 is up, line protocol is up
  Encapsulation ARPA
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
SW-1#

This is how you can change the advertisements interval and the hold time interval:

SW-1#show cdp  
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW-1(config)#cdp timer 30
SW-1(config)#cdp holdtime 120
SW-1(config)#end
SW-1#show cdp 
Global CDP information:
        Sending CDP packets every 30 seconds
        Sending a holdtime value of 120 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#

This is everything there is to know about CDP.

Next we will discuss LLDP. As mentioned before, LLDP is a neighbor discovery protocol. The protocol is covered by IEEE 801.1AB standard and allows interoperability between different vendors.

Like CDP, LLDP uses TLVs inside the messages to encode information about the systems.

While the number of TLVs supported differs from platform to platform, these TLVs are mandatory:

  • Port description
  • System name
  • System description
  • System capabilities
  • Management IP

The configuration and various “show” commands are almost identical to CDP.

By default, LLDP is disabled and can be enabled like this:

SW-1#show cdp  
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW-1(config)#cdp timer 30
SW-1(config)#cdp holdtime 120
SW-1(config)#end
SW-1#show cdp 
Global CDP information:
        Sending CDP packets every 30 seconds
        Sending a holdtime value of 120 seconds
        Sending CDPv2 advertisements is  enabled
SW-1#

After this is done, we can check if we have any LLDP neighbors:

SW-1#show  lldp  neighbors detail 
------------------------------------------------
Chassis id: 0027.0c1a.db80
Port id: Gi1/0/3
Port Description: GigabitEthernet1/0/3
System Name: SW-2

System Description: 
Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 15.0(2)SE1, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Fri 04-Jan-13 02:26 by prod_rel_team

Time remaining: 106 seconds
System Capabilities: B,R
Enabled Capabilities: B,R
Management Addresses:
    IP: 10.10.10.2
Auto Negotiation - supported, enabled
Physical media capabilities:
    Other/unknown
    Symm Pause(FD)
    Symm, Asym Pause(FD)
    1000baseX(FD)
    1000baseT(HD)
Media Attachment Unit type: 30
Vlan ID: 1

Total entries displayed: 1

SW-1#

As you can see, we get similar information as with CDP.

In a similar way, you can change the LLDP update interval and hold time:

SW-1(config)#lldp ?
  holdtime    Specify the hold time (in sec) to be sent in packets
  reinit      Delay (in sec) for LLDP initialization on any interface
  run         Enable LLDP
  timer       Specify the rate at which LLDP packets are sent (in sec)
  tlv-select  Selection of LLDP TLVs to send

SW-1(config)#lldp

One interesting option with LLDP is that you can select what TLV to send.

For instance, if you don’t want to send the corresponding TLV for port description, you can use this configuration:

SW-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW-1(config)#no lldp tlv-select port-description
SW-1(config)#end
SW-1#

Now that you have reached this point in the article, you should be able to:

  • Understand how CDP is working and how to interpret the output of “show” commands.
  • Configure CDP.
  • Check that CDP is working properly.
  • Understand the basics of LLDP.
  • Configure LLDP.

Reference: