Learn Cisco CLI – Part 2 – Cisco Discovery Protocol

Table of Contents
Learn Cisco CLI - Part 2

Cisco Discovery Protocol

These blog posts I created to help me as a reference tool, as well as a way of retaining the knowledge. If you find it useful that’s just a plus.

Configuration Commands

CDP Enable

Enables CDP on an interface. The command can be used in both the global and interface configuration modes. The no form of the command disables CDP on the interface.

				
					Syntax:
cdp enable
no cdp enable
				
			

Example:

				
					Router1>enable
Router1#configure terminal
Router1(config)#interface GigabitEthernet0/1 
Router1(config-if)#cdp enable
				
			

CDP Holdtime

Specifies or modifies the time (in seconds) that the receiving device should hold a CDP packet before discarding it.

				
					Syntax:
cdp holdtime 180
				
			

Example:

				
					Router1>enable
Router1#configure terminal
Router1(config)#interface GigabitEthernet0/1 
Router1(config-if)#cdp enable
Router1(config-if)#cdp holdtime 180
				
			

CDP Timer

Configures how often the Cisco IOS software sends CDP packets.

				
					Syntax:
cdp timer 60
				
			

Example:

				
					Router1>enable
Router1#configure terminal
Router1(config)#interface GigabitEthernet0/1 
Router1(config-if)#cdp enable
Router1(config-if)#cdp timer 30
				
			

Display Commands

Show CDP

Displays global CDP information, including timer and hold-time settings.

				
					Syntax:
show cdp
				
			

Example:

				
					Router1>enable
Router1#show cdp
				
			

Show CDP Entry

Displays detailed information about a specific neighboring device using CDP.

				
					Syntax:
show cdp entry *
show cdp entry {entry-name} [protocol | version]
				
			

Example:

				
					Router1>enable
Router1#show cdp entry SwitchA
				
			

Show CDP Interface

Displays information about interfaces on which CDP is enabled.

				
					Syntax:
show cdp interface [interface]
				
			

Example:

				
					Router1>enable
Router1#show cdp interface GigabitEthernet0/1
				
			

Show CDP Neighbors

Displays information about directly connected neighbors.

				
					Syntax:
show cdp neighbors
				
			

Example:

				
					Router1>enable
Router1#show cdp neighbors
				
			

Show CDP Detail

Provides detailed information about connected neighbors, including device types, interface names, and IP addresses.

				
					Syntax:
show cdp neighbors detail
				
			

Example:

				
					Router1>enable
Router1#show cdp neighbors detail
				
			

Show CDP Traffic

Displays information about traffic between devices gathered by using CDP.

				
					Syntax:
show cdp traffic
				
			

Example:

				
					Router1>enable
Router1#show cdp traffic
				
			

EVE-NG Lab

In this EVE-NG lab, I used a simple topology involving three routers (Router1, Router2, and Router3) connected via serial interfaces. This lab will guide you through configuring each router with the appropriate IP settings, enabling CDP, and verifying that CDP is functioning correctly.

Device Interface IP Address Subnet Mask
Router1
S0/0/0
10.1.1.1
255.255.255.0
Router2
S0/0/0
10.1.1.2
255.255.255.0
Router2
S0/0/1
172.16.10.2
255.255.255.0
Router3
S0/0/0
172.16.10.1
255.255.255.0

Configuring IP Addresses

Router1

Enter global configuration mode:

				
					Router1>enable
Router1#configure terminal
				
			

Configure the IP address for S0/0/0 interface:

				
					Router1(config)# interface Serial 0/0/0
Router1(config-if)# ip address 10.1.1.1 255.255.255.0
Router1(config-if)# no shutdown
				
			

Exit the interface configuration mode:

				
					Router1(config-if)# exit
				
			

Router2

Enter global configuration mode:

				
					Router2>enable
Router2#configure terminal
				
			

Configure the IP address for S0/0/0 interface:

				
					Router2(config)# interface Serial 0/0/0
Router2(config-if)# ip address 10.1.1.2 255.255.255.0
Router2(config-if)# no shutdown
				
			

Configure the IP address for S0/0/1 interface:

				
					Router2(config)# interface Serial 0/0/1
Router2(config-if)# ip address 172.16.10.2 255.255.255.0
Router2(config-if)# no shutdown
				
			

Exit the interface configuration mode:

				
					Router2(config-if)# exit
				
			

Router3

Enter global configuration mode:

				
					Router3>enable
Router3#configure terminal
				
			

Configure the IP address for S0/0/0 interface:

				
					Router3(config)# interface Serial 0/0/0
Router3(config-if)# ip address 172.16.10.1 255.255.255.0
Router3(config-if)# no shutdown
				
			

Exit the interface configuration mode:

				
					Router3(config-if)# exit
				
			

Enabling CDP

All Routers

CDP is enabled by default on Cisco routers. However, if it has been disabled, you can re-enable it:

				
					Router>enable
Router#configure terminal
Router(config)#cdp run
				
			

Verify that CDP is enabled on each interface:

				
					Router>enable
Router#show cdp interfaces
				
			

Verify CDP Configuration

All Routers

After enabling CDP, you can verify the configuration and check for neighboring devices:

				
					Router>enable
Router#show cdp neighbors
				
			

Display detailed information:

				
					Router>enable
Router#show cdp neighbors detail
				
			

Leave a Comment