Discovering Devices with CDP and LLDP
Automate network topology mapping and device discovery for real-time infrastructure insights
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, allowing devices to share information about their neighbors including device IDs, port IDs, and platform details.
LLDP is the open-standard alternative that shines in multi-vendor ecosystems. Designed for interoperability, LLDP enables devices from various manufacturers; Juniper, HP/Aruba, Arista, and virtual platforms like VMware ESXi and Proxmox; to advertise their identity and capabilities across directly connected Layer 2 links.
Cisco Discovery Protocol (CDP)
CDP is Cisco's proprietary Layer 2 protocol, enabled by default on Cisco devices. It sends periodic advertisements to directly connected neighbors, sharing vital information that helps administrators understand their network topology.
CDP Information Elements
| 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
# Enable CDP globally (default on Cisco devices) Router(config)# cdp run Router(config)# cdp timer 60 # Advertisement interval (default: 60s) Router(config)# cdp holdtime 180 # Hold time before aging out (default: 180s) # Interface-specific configuration Router(config)# interface gigabitethernet0/1 Router(config-if)# cdp enable
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)
LLDP is the IEEE 802.1AB open standard for neighbor discovery, using Type-Length-Value (TLV) format to share standardized information across all vendor platforms. It is the preferred protocol in multi-vendor environments.
LLDP TLV Elements
| 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 string | Optional |
| System Capabilities | Device role capabilities | Optional |
| Management Address | IP address for management | Optional |
Platform Support
- 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
- VMware ESXi / vSphere Distributed Switch
- Microsoft Hyper-V
- Linux Open vSwitch
- Citrix XenServer
- pfSense (FreeBSD-based)
- Proxmox VE
LLDP Configuration Examples
Router(config)# lldp run Router(config)# lldp timer 30 # Advertisement interval (default: 30s) Router(config)# lldp holdtime 120 # Hold time (default: 4x timer) # Interface-specific transmit/receive Router(config)# interface gigabitethernet0/1 Router(config-if)# lldp transmit Router(config-if)# lldp receive
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
CDP vs LLDP Comparison
| Feature | CDP | LLDP |
|---|---|---|
| Standard | Cisco Proprietary | IEEE 802.1AB Open Standard |
| Default State | Enabled on Cisco | Disabled (must enable) |
| Vendor Support | Cisco only | All major vendors |
| Timer (default) | 60 seconds | 30 seconds |
| Holdtime (default) | 180 seconds | 120 seconds |
| Virtual Support | Limited | VMware, Hyper-V, OVS |
| PoE Negotiation | Yes (CDP PoE) | Yes (LLDP-MED) |
| VLAN Info | Yes | Via LLDP-MED extensions |
Modern Discovery Tools
Best Practices
- Enable LLDP on all devices in multi-vendor environments for consistent topology data
- Disable CDP and LLDP on external-facing, DMZ, and guest-facing interfaces
- Use
show cdp neighbors detailandshow lldp neighbors detailfor full device information - Integrate discovery data with your CMDB or network documentation system
- Verify cabling by comparing expected vs. actual neighbor relationships
- Schedule regular topology exports to track infrastructure changes over time
- Consider LLDP-MED for VoIP environments to enable PoE and VLAN auto-configuration
