1. Discovering Devices with CDP and LLDP

“Automate network topology mapping and device discovery using CDP and LLDP protocols for real-time insights”

Network Management

A Practical Guide to Discovering, Maintaining, and Monitoring Your Network

Discovering Devices with CDP and LLDP

One of the first steps in managing a network is knowing what’s connected. Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) serve this purpose. CDP is Cisco’s proprietary Layer 2 protocol, enabled by default on Cisco devices, and allows devices to send and receive information about their neighbors. This includes device IDs, port IDs, and platform information, which can be accessed using commands like show cdp neighbors or show cdp neighbors detail.
 
The Link Layer Discovery Protocol (LLDP) on the other hand, is the open-standard alternative that shines in multi-vendor ecosystems. Designed for interoperability, LLDP enables devices from various manufacturers, such as Juniper, HP/Aruba, Arista, and virtual platforms like pfSense, VMware ESXi, or Proxmox, to advertise their identity and capabilities across directly connected Layer 2 links.
 
Network administrators can enable LLDP with a simple lldp run command and then use show lldp neighbors to reveal a structured view of adjacent devices. This provides a powerful, hardware agnostic way to map network topology, verify cabling, and streamline documentation, without the need for manual inspection. In modern enterprise and data center environments where mixed vendor hardware is the norm, LLDP is not just helpful, it’s essential for effective network visibility and troubleshooting.

In any well-managed network, visibility is key, and neighbor discovery protocols are among the most fundamental tools for gaining it. Whether it’s identifying a new device connection, verifying cable runs, or troubleshooting connectivity issues, your network devices can automatically share critical information about their neighbors. CDP and LLDP provide the mechanisms to discover and map your network topology without manual intervention.

Both CDP and LLDP operate at Layer 2, sending periodic advertisements to directly connected neighbors. These protocols enable automatic topology discovery, providing administrators with real-time visibility into network connections and device capabilities.

Cisco Discovery Protocol (CDP)

CDP is Cisco’s proprietary Layer 2 protocol, enabled by default on Cisco devices, and allows devices to send and receive information about their neighbors. These advertisements contain vital pieces of information that help administrators understand their network topology.

CDP Information Elements

CDP Information Elements

Comprehensive Device Information Shared Through Periodic Advertisements

Information Type Description Example
Device ID Hostname of the device Switch-Core-01
Port ID Local and remote interface GigabitEthernet0/1
Capabilities Device type and functions Router, Switch, IGMP
Platform Hardware model WS-C3850-24T
IP Address Management IP addresses 192.168.1.10
Software Version IOS version information 15.2(4)E7
VTP Domain VLAN Trunking Protocol domain CORP_DOMAIN
CDP Configuration Guide
CDP Configuration and Management Guide
CDP Timers and Configuration
Basic CDP Configuration
bash
# Enable CDP globally (default on Cisco devices) Router(config)# cdp run # Configure CDP timers Router(config)# cdp timer 60 # Advertisement interval (default: 60 seconds) Router(config)# cdp holdtime 180 # Hold time before aging out (default: 180 seconds) # Interface-specific configuration Router(config)# interface gigabitethernet0/1 Router(config-if)# cdp enable
Example CDP Output
CDP Neighbors Output
output
Device ID Local Intrfce Holdtme Capability Platform Port ID Core-SW-01 Gig 0/1 157 R S I WS-C3850 Gig 0/24 Access-SW-02 Gig 0/2 143 S I WS-C2960 Gig 0/1 Router-WAN Gig 0/3 168 R ISR4331 Gig 0/0/0

Link Layer Discovery Protocol (LLDP)

The Link Layer Discovery Protocol (LLDP) is the open-standard alternative that shines in multi-vendor ecosystems. Designed for interoperability, LLDP enables devices from various manufacturers to advertise their identity and capabilities across directly connected Layer 2 links.

LLDP Standard Information Elements

LLDP Standard Information Elements

LLDP Standard Information Elements
LLDP provides standardized information across all vendor platforms using Type-Length-Value (TLV) format:
TLV Type Description Mandatory
Chassis ID Unique chassis identifier Yes
Port ID Port identifier Yes
TTL Time to Live Yes
System Name Device hostname Optional
System Description Device description Optional
System Capabilities Device capabilities Optional
Management Address IP address for management Optional

Broad Compatibility and Platform Support

LLDP isn’t just for network switches—it’s an open standard supported across platforms and operating systems:

Network Devices

  • Cisco: IOS, IOS-XE, IOS-XR, NX-OS
  • Juniper: Junos
  • HP/Aruba: ArubaOS, ProCurve
  • Arista: EOS
  • Dell: OS6, OS9, OS10
  • Extreme Networks: ExtremeXOS
  • Fortinet: FortiOS

Virtual Platforms

  • VMware: ESXi vSphere Distributed Switch
  • Citrix: XenServer
  • Microsoft: Hyper-V
  • Linux: Open vSwitch
  • pfSense: FreeBSD-based firewall
LLDP Configuration Guide
LLDP Configuration Examples
Cisco Configuration
bash
# Enable LLDP globally Router(config)# lldp run # Configure LLDP timers Router(config)# lldp timer 30 # Advertisement interval (default: 30 seconds) Router(config)# lldp holdtime 120 # Hold time multiplier (default: 4x timer) # Interface-specific configuration Router(config)# interface gigabitethernet0/1 Router(config-if)# lldp transmit Router(config-if)# lldp receive
HP/Aruba Configuration
bash
# Enable LLDP globally Switch(config)# lldp global-enable # Configure per-interface Switch(config)# interface 1/1/1 Switch(config-if)# lldp config-notification Switch(config-if)# lldp config-tlv-select basic-mgmt
Example LLDP Output
output
Local Intf: Gi0/1 Chassis id: 00:23:04:ee:be:00 Port id: 24 Port Description: GigabitEthernet1/0/24 System Name: HP-2930F-Stack System Description: HP 2930F-24G-4SFP+ Switch System Capabilities: B (Bridge) Management Addresses: IP: 192.168.1.50

Protocol Comparison and Modern Discovery Tools

CDP vs LLDP Feature Comparison

CDP vs LLDP Feature Comparison

Protocol Comparison for Network Discovery

Feature CDP LLDP
Standard Cisco Proprietary IEEE 802.1AB (Open)
Vendor Support Cisco Only Multi-vendor
Default State Enabled Usually Disabled
Advertisement Interval 60 seconds 30 seconds
Hold Time 180 seconds 120 seconds
Information Richness Very Detailed Standardized Set
VTP Domain Info Yes No
Power Management Limited PoE information

Network Management Integration

Protocol Support in Popular Network Management Tools

Tool CDP Support LLDP Support Key Features
SolarWinds NPM Yes Yes Automatic topology mapping
PRTG Yes Yes Real-time monitoring
LibreNMS Yes Yes Open-source, multi-vendor
Observium Yes Yes Auto-discovery, graphing
Nagios Plugin Plugin Alerting, status monitoring

Best Practices for Network Discovery Implementation

Network Discovery Protocol Configuration Guide
1. Configure Appropriate Security Policies
bash
# Disable on untrusted interfaces interface gigabitethernet0/1 description "Internet Connection" no cdp enable no lldp transmit no lldp receive
2. Implement Selective Protocol Deployment
bash
# Internal interfaces - enable both protocols interface range gigabitethernet0/1-24 cdp enable lldp transmit lldp receive # External interfaces - disable for security interface gigabitethernet0/25 description "DMZ Connection" no cdp enable no lldp transmit no lldp receive
3. Set Up Automated Documentation
bash
# Automated topology discovery script #!/bin/bash for device in $(cat device_list.txt); do ssh $device "show cdp neighbors detail" >> topology_$(date +%Y%m%d).txt ssh $device "show lldp neighbors detail" >> topology_$(date +%Y%m%d).txt done
Sample Complete Configuration
Cisco Multi-Protocol Configuration
bash
# Global CDP/LLDP configuration cdp run lldp run # Service timestamps for event correlation service timestamps log datetime localtime show-timezone msec # Configure timers cdp timer 60 cdp holdtime 180 lldp timer 30 # Interface configuration for access ports interface range gigabitethernet0/1-24 description Access Ports cdp enable lldp transmit lldp receive # Uplink interfaces interface range gigabitethernet0/25-28 description Uplink Ports cdp enable lldp transmit lldp receive # External interface (security hardened) interface gigabitethernet0/29 description Internet Connection no cdp enable no lldp transmit no lldp receive
Multi-Vendor Discovery Script
bash
#!/bin/bash # Network discovery across multiple vendors cisco_discovery() { ssh admin@$1 "show cdp neighbors detail; show lldp neighbors detail" } hp_discovery() { ssh admin@$1 "show lldp info remote-device" } juniper_discovery() { ssh admin@$1 "show lldp neighbors detail" } # Execute discovery based on vendor for device in $(cat network_devices.txt); do vendor=$(grep $device vendor_mapping.txt | cut -d: -f2) case $vendor in cisco) cisco_discovery $device ;; hp) hp_discovery $device ;; juniper) juniper_discovery $device ;; esac done

Conclusion

Effective neighbor discovery implementation transforms your network from a collection of isolated devices into a well-documented, easily manageable infrastructure. Network administrators can enable LLDP with a simple lldp run command and then use show lldp neighbors to reveal a structured view of adjacent devices. This provides a powerful, hardware-agnostic way to map network topology, verify cabling, and streamline documentation, without the need for manual inspection.

In modern enterprise and data center environments where mixed vendor hardware is the norm, LLDP is not just helpful, it’s essential for effective network visibility and troubleshooting. While CDP remains valuable in Cisco-centric environments, implementing both protocols strategically, with proper security considerations, creates a foundation for comprehensive network management.

Start with basic neighbor discovery on critical devices, then gradually expand coverage while implementing security best practices for edge connections. The combination of automated discovery and proper documentation ensures you maintain visibility and control over your network infrastructure.

 
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x