CDP and LLDP Configuration and Neighbor Discovery
Objectives
- Understand the purpose and differences between CDP and LLDP.
- Configure and enable CDP and LLDP on Cisco networking devices.
- Discover directly connected neighboring network devices.
- Identify the local and remote interfaces connected between networking devices.
- Use CDP and LLDP verification commands to troubleshoot network connections.
Theory
CDP (Cisco Discovery Protocol) and LLDP (Link Layer Discovery Protocol) are Layer 2 discovery protocols used by network devices to share information about directly connected neighboring devices.
These protocols help network administrators identify connected devices, discover the interfaces used to connect them, and understand the physical network topology without manually tracing every cable.
1. CDP (Cisco Discovery Protocol)
CDP is a Cisco-proprietary Layer 2 discovery protocol. It allows Cisco devices such as switches, routers and other supported equipment to advertise information about themselves to directly connected Cisco neighbors.
CDP can provide information such as the neighboring device name, local interface, remote interface, device capabilities, platform and management IP address.
2. LLDP (Link Layer Discovery Protocol)
LLDP is an open-standard Layer 2 discovery protocol defined by IEEE 802.1AB. Unlike CDP, LLDP supports communication between networking devices from different manufacturers.
LLDP allows network devices to advertise their identity, capabilities and interface information to directly connected neighbors.
Comparison Between CDP and LLDP
| Feature | CDP | LLDP |
|---|---|---|
| Full Form | Cisco Discovery Protocol | Link Layer Discovery Protocol |
| Type | Proprietary (Cisco) | Open standard |
| Compatibility | Primarily Cisco devices | Multi-vendor devices |
| Default State | Enabled on many Cisco devices by default | Often disabled by default on Cisco devices |
| Standard | Cisco-defined | IEEE 802.1AB |
| Discovery | Discovers directly connected CDP neighbors | Discovers directly connected LLDP neighbors |
How CDP and LLDP Work
Both protocols send discovery advertisements through directly connected network interfaces. Neighboring devices receive these advertisements and store the received information in a neighbor table.
Network administrators can then use show commands to identify which device is connected to a particular local interface and which remote interface is being used on the neighboring device.
Important: CDP and LLDP discover directly connected neighbors. They do not automatically reveal every device across the entire network.
Network Topology
Configuration Commands
1. Enable CDP
Switch / Router
enable configure terminal ! Enable CDP globally cdp run end
The cdp run command enables CDP globally on the networking device. CDP is commonly enabled by default on Cisco devices, but this command can be used to ensure that it is active.
2. Enable LLDP
Switch / Router
enable configure terminal ! Enable LLDP globally lldp run end
The lldp run command enables LLDP globally on supported Cisco devices. LLDP must also be enabled and transmitting on the neighboring device for neighbor information to be discovered.
3. Identify Connected Devices Using CDP
Switch / Router
enable ! Display a summary of directly connected CDP neighbors show cdp neighbors ! Display detailed information about CDP neighbors show cdp neighbors detail ! Display CDP status and timer information show cdp
4. Identify Connected Devices Using LLDP
Switch / Router
enable ! Display a summary of directly connected LLDP neighbors show lldp neighbors ! Display detailed information about LLDP neighbors show lldp neighbors detail ! Display LLDP traffic counters show lldp traffic
After enabling CDP and LLDP, use the neighbor commands on each networking device to identify the connected device and its interface. Record the local and remote interface information and label the corresponding connections in the network topology.
Verification Commands & Outputs
1. Verify CDP Neighbors
Device ID Local Intrfce Holdtme Capability Platform Port ID Router0 Gig 0/1 153 R ISR Gig 0/0 Switch1 Fa 0/1 145 S 2960 Fa 0/1 Switch2 Fa 0/2 142 S 2960 Fa 0/2
Explanation: The output displays neighboring device names, the local interface, device capabilities, platform and remote interface. For example, Switch1 is connected through the local Fa0/1 interface and its remote Fa0/1 interface.
2. Verify Detailed CDP Information
------------------------- Device ID: Switch1 Entry address(es): IP address: 192.168.1.2 Platform: cisco WS-C2960, Capabilities: Switch Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/1 Holdtime: 145 sec Version: Cisco IOS Software ------------------------- Device ID: Router0 Entry address(es): IP address: 192.168.1.1 Platform: Cisco ISR, Capabilities: Router Interface: GigabitEthernet0/1, Port ID (outgoing port): GigabitEthernet0/0 Holdtime: 153 sec
3. Verify LLDP Neighbors
Capability codes: (R) Router, (B) Bridge, (W) WLAN Access Point, (T) Telephone, (D) DOCSIS Cable Device, (S) Station, (O) Other Device ID Local Intf Hold-time Capability Port ID Switch1 Fa0/1 120 B Fa0/1 Router0 Gi0/1 120 R Gi0/0 Switch2 Fa0/2 120 B Fa0/2
4. Verify Detailed LLDP Information
------------------------------------------------ Chassis id: 0001.0001.0001 Port id: FastEthernet0/1 Port Description: FastEthernet0/1 System Name: Switch1 System Description: Cisco IOS Software Time remaining: 120 seconds System Capabilities: B Enabled Capabilities: B ------------------------------------------------ Chassis id: 0002.0002.0002 Port id: GigabitEthernet0/0 Port Description: GigabitEthernet0/0 System Name: Router0 System Description: Cisco IOS Software Time remaining: 120 seconds System Capabilities: R Enabled Capabilities: R
Note: The verification outputs are illustrative. Actual device names, IP addresses, interface names, capabilities and output formatting depend on the topology and device model. Some Packet Tracer devices may not support every CDP or LLDP command.