Master Layer 2 Discovery with CDP and LLDP!
Table of Contents
- Introduction to Layer 2 Discovery Protocols
- Cisco Discovery Protocol (CDP)
- Link Layer Discovery Protocol (LLDP)
- CDP vs. LLDP: Similarities and Differences
- How CDP Works
- CDP Show Commands and Configuration
- How LLDP Works
- LLDP Show Commands and Configuration
- Wireshark Captures: CDP and LLDP
- Quiz: Test Your Knowledge
Introduction to Layer 2 Discovery Protocols
Layer 2 discovery protocols such as Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) play a crucial role in discovering and sharing information about neighboring devices in a network. These protocols operate at Layer 2 of the OSI model and enable devices to exchange valuable data such as device type, host name, IP address, and software version. In this article, we will explore the functionalities, configurations, and differences between CDP and LLDP, as well as examine how these protocols work in practice.
Cisco Discovery Protocol (CDP)
CDP is a proprietary Layer 2 discovery protocol developed by Cisco. It is enabled by default on Cisco devices and allows for the automatic identification and sharing of information between directly connected Cisco devices. With CDP, devices periodically send CDP messages containing essential details such as hostname, IP address, device type, and capabilities. These messages are only processed and discarded by the receiving device and are not forwarded to other devices. CDP provides valuable insights into the network topology and assists in troubleshooting and network management tasks.
CDP offers a range of show commands that allow network engineers to gather information about neighboring devices, such as SHOW CDP, SHOW CDP TRAFFIC, SHOW CDP INTERFACE, and SHOW CDP NEIGHBORS. Additionally, CDP can be configured globally or on specific interfaces, and the CDP timers and version can be adjusted to suit the network's requirements.
Link Layer Discovery Protocol (LLDP)
LLDP is an industry standard Layer 2 discovery protocol that serves a similar purpose to CDP but with the advantage of being vendor-agnostic. It allows devices from different vendors to exchange information about their capabilities and configurations. Unlike CDP, LLDP is not enabled by default on Cisco devices and must be manually enabled. LLDP messages are sent periodically and carry important data such as system name, interface status, VLAN information, and management IP address.
Similar to CDP, LLDP provides various show commands like SHOW LLDP, SHOW LLDP TRAFFIC, SHOW LLDP INTERFACE, and SHOW LLDP NEIGHBORS to gather information about neighboring devices. LLDP can be enabled globally or on specific interfaces, and its timers can be adjusted to determine the frequency of message transmission.
CDP vs. LLDP: Similarities and Differences
CDP and LLDP are both Layer 2 discovery protocols that facilitate the sharing of information between neighboring devices. They operate at Layer 2 and don't depend on IP addresses for communication. These protocols help network administrators in mapping the network topology, identifying connected devices, and streamlining troubleshooting processes.
While CDP is proprietary to Cisco, LLDP is an industry standard supported by multiple vendors. This distinction means that CDP is primarily used in Cisco environments, while LLDP is recommended for heterogeneous networks with devices from different vendors.
In terms of functionality, both protocols share similarities. They enable the discovery of neighboring devices, provide valuable device information, and allow for efficient network management and troubleshooting. However, there are some key differences between CDP and LLDP in terms of configuration options, supported platforms, and the extent of information shared.
How CDP Works
CDP operates by exchanging CDP messages between directly connected devices. These messages are sent periodically and contain vital information about the sending device. When a CDP message is received, the receiving device processes the information and adds an entry for the sending device in its CDP neighbor table. This table keeps track of all neighboring devices and their associated information. If a CDP message is not received from a neighbor for a specific duration (default 180 seconds), that neighbor's entry is removed from the table.
CDP uses multicast MAC address 0100.0CCC.CCCC for message transmission. The message includes details such as device ID, local interface, capabilities, and platform. CDP messages do not traverse beyond directly connected devices, ensuring that only neighboring devices become CDP neighbors. CDP version 2 is the default version and offers additional advanced features compared to version 1.
CDP Show Commands and Configuration
Administrators can utilize various show commands to gather information about neighboring devices and the CDP configuration itself. SHOW CDP provides an overview of timers, hold time, and version used by CDP. SHOW CDP TRAFFIC displays statistics about CDP packets sent and received. SHOW CDP INTERFACE shows the status of CDP on each interface, including the encapsulation type. Finally, SHOW CDP NEIGHBORS provides detailed information about neighboring devices, such as device ID, local interface, and hold time.
When it comes to CDP configuration, CDP RUN and NO CDP RUN enable or disable CDP globally, respectively. CDP ENABLE and NO CDP ENABLE enable or disable CDP on a specific interface. The CDP TIMER command sets the frequency at which CDP messages are sent, while CDP HOLDTIME configures the duration after which a neighbor is removed from the CDP neighbor table. CDP ADVERTISE-V2 enables version 2 of CDP, offering advanced features.
How LLDP Works
Similar to CDP, LLDP operates by exchanging LLDP messages between neighboring devices. These messages contain essential information such as system name, port ID, capabilities, and management IP address. LLDP messages are sent periodically, enabling devices to discover and maintain information about their directly connected neighbors. Unlike CDP, LLDP messages do not pass beyond directly connected devices, ensuring that only neighbors become LLDP neighbors.
LLDP uses multicast MAC address 0180.C200.000E for message transmission. It follows the same principle as CDP, where receiving devices process and discard LLDP messages without forwarding them. LLDP messages have a default timer of 30 seconds for transmission and a hold time of 120 seconds. An additional reinitialization delay timer of 2 seconds is present in case of rapid enable/disable situations.
LLDP Show Commands and Configuration
To obtain information about neighboring devices and the LLDP configuration, administrators can use several show commands. SHOW LLDP provides an overview of LLDP timers and enabled/disabled states. SHOW LLDP TRAFFIC shows statistics related to sent and received LLDP frames. SHOW LLDP INTERFACE displays the transmit and receive states for each interface, along with the interface's operational status.
In terms of LLDP configuration, LLDP RUN and NO LLDP RUN enable or disable LLDP globally, respectively. LLDP TRANSMIT and LLDP RECEIVE enable LLDP transmission and reception on a specific interface, respectively. The LLDP TIMER command sets the duration between LLDP message transmissions. LLDP HOLDTIME sets the hold time before a neighbor is removed from the LLDP neighbor table. Lastly, LLDP REINIT configures the reinitialization delay timer, but this is generally unnecessary for CCNA-level knowledge.
Wireshark Captures: CDP and LLDP
To gain a deeper understanding of CDP and LLDP in action, Wireshark captures provide a clear view of the protocols' messages. A CDP capture showcases the CDP messages sent between devices, including details such as CDP version, device ID, capabilities, and port ID. It is important to note that CDP messages do not contain any IP packets, as CDP operates solely at Layer 2.
Similarly, an LLDP capture displays LLDP messages exchanged between devices, offering insights into LLDP version, system name, capabilities, and time to live (TTL). Like CDP, LLDP messages do not include IP packets and focus solely on Layer 2 communication.
These Wireshark captures serve as valuable references for understanding the inner workings of CDP and LLDP.
Quiz: Test Your Knowledge
To assess your understanding of the concepts covered in this article, we have prepared a quiz. Take some time to answer the questions and check your answers at the end.
Conclusion
Layer 2 discovery protocols such as CDP and LLDP are essential tools for network administrators to gather information about neighboring devices and streamline network management tasks. While CDP is a Cisco proprietary protocol and LLDP is an industry standard, they both serve similar purposes and offer valuable insights into network topology. Understanding the functionalities, configurations, and differences between CDP and LLDP is crucial for network professionals seeking to optimize their network infrastructure.